Skip to content
Snippets Groups Projects
Commit 18f070b7 authored by Rodrigo Nascimento's avatar Rodrigo Nascimento
Browse files

Join user in room via mention

parent 147b3a3a
No related merge requests found
...@@ -99,6 +99,14 @@ RocketChat.sendMessage = (user, message, room, options) -> ...@@ -99,6 +99,14 @@ RocketChat.sendMessage = (user, message, room, options) ->
mentionIds.push mention._id mentionIds.push mention._id
if mentionIds.length > 0 if mentionIds.length > 0
usersOfMention = Meteor.users.find({_id: {$in: mentionIds}}, {fields: {_id: 1}}).fetch()
if mentionIds.indexOf('all') is -1
for usersOfMentionItem in usersOfMention
if room.usernames.indexOf(usersOfMentionItem.username) is -1
Meteor.runAsUser usersOfMentionItem._id, ->
Meteor.call 'joinRoom', room._id
### ###
Update all other subscriptions of mentioned users to alert their owners and incrementing Update all other subscriptions of mentioned users to alert their owners and incrementing
the unread counter for mentions and direct messages the unread counter for mentions and direct messages
...@@ -141,7 +149,6 @@ RocketChat.sendMessage = (user, message, room, options) -> ...@@ -141,7 +149,6 @@ RocketChat.sendMessage = (user, message, room, options) ->
query._id = query._id =
$in: mentionIds $in: mentionIds
usersOfMention = Meteor.users.find(query, {fields: {_id: 1}}).fetch()
usersOfMentionIds = _.pluck(usersOfMention, '_id'); usersOfMentionIds = _.pluck(usersOfMention, '_id');
if usersOfMentionIds.length > 0 if usersOfMentionIds.length > 0
Push.send Push.send
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment