Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
Rocket.Chat
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
RocketChat
Rocket.Chat
Commits
18f070b7
Commit
18f070b7
authored
9 years ago
by
Rodrigo Nascimento
Browse files
Options
Downloads
Patches
Plain Diff
Join user in room via mention
parent
147b3a3a
Loading
Loading
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
packages/rocketchat-lib/server/sendMessage.coffee
+8
-1
8 additions, 1 deletion
packages/rocketchat-lib/server/sendMessage.coffee
with
8 additions
and
1 deletion
packages/rocketchat-lib/server/sendMessage.coffee
+
8
−
1
View file @
18f070b7
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment