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
5c993f16
Commit
5c993f16
authored
9 years ago
by
Rodrigo Nascimento
Browse files
Options
Downloads
Patches
Plain Diff
Set alert, open room and increate unread for all users in room if there is a mention for 'all'
parent
8d2f2fe2
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
packages/rocketchat-lib/server/sendMessage.coffee
+12
-4
12 additions, 4 deletions
packages/rocketchat-lib/server/sendMessage.coffee
with
12 additions
and
4 deletions
packages/rocketchat-lib/server/sendMessage.coffee
+
12
−
4
View file @
5c993f16
...
@@ -79,12 +79,18 @@ RocketChat.sendMessage = (user, message, room) ->
...
@@ -79,12 +79,18 @@ RocketChat.sendMessage = (user, message, room) ->
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
###
###
ChatSubscription
.
update
query
=
# only subscriptions to the same room
# only subscriptions to the same room
rid
:
message
.
rid
rid
:
message
.
rid
# the mentioned user
'u._id'
:
mention
.
_id
if
mention
.
_id
is
'all'
,
# all users except sender if mention is for all
query
[
'u._id'
]
=
$ne
:
user
.
_id
else
# the mentioned user if mention isn't for all
query
[
'u._id'
]
=
mention
.
_id
ChatSubscription
.
update
query
,
$set
:
$set
:
# alert de user
# alert de user
alert
:
true
alert
:
true
...
@@ -93,6 +99,8 @@ RocketChat.sendMessage = (user, message, room) ->
...
@@ -93,6 +99,8 @@ RocketChat.sendMessage = (user, message, room) ->
# increment unread couter
# increment unread couter
$inc
:
$inc
:
unread
:
1
unread
:
1
,
multi
:
true
###
###
Update all other subscriptions to alert their owners but witout incrementing
Update all other subscriptions to alert their owners but witout incrementing
...
...
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