Skip to content

[NEW] REST API to use Spotlight#9509

Merged
rodrigok merged 6 commits intodevelopfrom
feature/api_rest_spotlight.9508
Feb 15, 2018
Merged

[NEW] REST API to use Spotlight#9509
rodrigok merged 6 commits intodevelopfrom
feature/api_rest_spotlight.9508

Conversation

@rafaelks
Copy link
Copy Markdown
Contributor

@rafaelks rafaelks commented Jan 25, 2018

@RocketChat/core

Closes #9508

Progress

@rafaelks rafaelks changed the title [NEW] REST API to use Spotlight [WIP][NEW] REST API to use Spotlight Jan 25, 2018
@engelgabriel engelgabriel temporarily deployed to rocket-chat-pr-9509 January 25, 2018 23:03 Inactive
@engelgabriel engelgabriel temporarily deployed to rocket-chat-pr-9509 January 26, 2018 13:07 Inactive
@RocketChat RocketChat deleted a comment Jan 26, 2018
@engelgabriel engelgabriel temporarily deployed to rocket-chat-pr-9509 January 26, 2018 13:33 Inactive
rooms: true,
users: true
})
);
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@RocketChat/core For some reason, this method ALWAYS returns rooms empty. I tried debugging it already and it's entering the part of the code that queries per rooms, so I don't know what's going on. Here's the call example I'm using:

curl -X GET -H "X-Auth-Token: 6eWs4ECxUITYYoZ_bAYK5OE2srkxAepQqQA1cGGv3jK" -H "X-User-Id: hvzu8z6mHFigiXy6Y" http://localhost:3000/api/v1/spotlight?query=t

And I do have a room with the name of general and testing-public-channel. The users I'm trying also have all the permissions required to search by rooms: view-outside-room and view-c-room. Does someone have any idea what's going on?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The query must be a valid json object.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@graywolf336 What do you mean? It works for users... do you have an example of how it should be?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Never mind, I thought you was doing something else. Ignore my comment.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rafaelks If you call it via DDP it returns data for rooms?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rodrigok How can I do that?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exactly as you wrote for the server side call, but from you browser (logged in)

Meteor.call('spotlight', 't', null, {
				rooms: true,
				users: true
			})

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Per our chat, the API is correct & it's not returning the objects because user already joined the rooms.

@RocketChat RocketChat deleted a comment Jan 26, 2018
@engelgabriel engelgabriel temporarily deployed to rocket-chat-pr-9509 January 26, 2018 13:48 Inactive
@rodrigok rodrigok added this to the 0.62.0 milestone Jan 26, 2018
@rafaelks rafaelks changed the title [WIP][NEW] REST API to use Spotlight [NEW] REST API to use Spotlight Jan 27, 2018
@theorenck theorenck assigned theorenck and rodrigok and unassigned theorenck Jan 30, 2018
Copy link
Copy Markdown
Contributor

@MarcosSpessatto MarcosSpessatto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great Work @rafaelks !


let result;
Meteor.runAsUser(this.userId, () =>
result = Meteor.call('spotlight', query, null, {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MarcosSpessatto change to use result from Meteor.runAsUser return

small fix
@rafaelks
Copy link
Copy Markdown
Contributor Author

Is this PR missing something @rodrigok @MarcosSpessatto?

@geekgonecrazy geekgonecrazy dismissed rodrigok’s stale review February 15, 2018 18:10

looks like feedback was addressed

@rodrigok rodrigok merged commit 28c8b7b into develop Feb 15, 2018
@rodrigok rodrigok deleted the feature/api_rest_spotlight.9508 branch February 15, 2018 19:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants