-
Notifications
You must be signed in to change notification settings - Fork 597
Message search #364
base: master
Are you sure you want to change the base?
Message search #364
Conversation
Thanks for submitting this @Mini-Geek. It's a lot of functionality that seems a little complicated to use directly so I'm not sure how to properly expose it, but it's great to have this functionality explored like this and I'll leave the PR open in case anyone else wants to contribute their opinions. |
Hey Thanks for that PR. What does |
When you do a search and click on a result to see the context, search_context.php is called. Also when you click to see more context above or below the found message, it calls search_context.php. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah ok that makes sense. Could you document both functions? I left a bunch of comments too :)
After that we can merge!
Thanks
|
||
module.exports = function(defaultFuncs, api, ctx) { | ||
return function searchContext(messageID, threadID, isGroup, limit, direction, callback) { | ||
if(!callback && utils.getType(threadID) === 'Function') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you do utils.getType(threadID) !== "String"
instead?
limit: limit || 6, | ||
direction: direction, | ||
}; | ||
if (isGroup) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you remove isGroup
and use the same trick we used in sendMessage
facebook-chat-api/src/sendMessage.js
Line 155 in 9da5303
api.getUserInfo(threadID, function(err, res) { |
We make a call to
getUserInfo
and do Object.keys(res).length > 0
, if it's true
then it's a 1-1 thread, if it's false then it's a group thread.
So this is not very polished or documented, but it does work. This adds the message search feature requested in issue #287.