@@ -3,8 +3,6 @@ RocketChat.sendMessage = (user, message, room) ->
3
3
if not user or not message or not room ._id
4
4
return false
5
5
6
- console .log ' [functions] RocketChat.sendMessage -> ' .green , ' arguments:' , arguments
7
-
8
6
unless message .ts ?
9
7
message .ts = new Date ()
10
8
@@ -78,8 +76,10 @@ RocketChat.sendMessage = (user, message, room) ->
78
76
if userOfMention?
79
77
Push .send
80
78
from : ' push'
81
- title : userOfMention .username
82
- text : " #{ userOfMention .username } : #{ message .msg } "
79
+ title : " @#{ user .username } "
80
+ text : message .msg
81
+ apn :
82
+ text : " @#{ user .username } :\n #{ message .msg } "
83
83
badge : 1
84
84
sound : ' chime'
85
85
payload :
@@ -136,20 +136,22 @@ RocketChat.sendMessage = (user, message, room) ->
136
136
query ._id =
137
137
$in : mentionIds
138
138
139
- usersOfMention = Meteor .users .find (query, {fields : {username : 1 }}).fetch ()
140
- if usersOfMention .length > 0
141
- for userOfMention in usersOfMention
142
- Push .send
143
- from : ' push'
144
- title : userOfMention .username
145
- text : message .msg
146
- badge : 1
147
- sound : ' chime'
148
- payload :
149
- rid : message .rid
150
- sender : message .u
151
- query :
152
- userId : userOfMention ._id
139
+ usersOfMention = Meteor .users .find (query, {fields : {_id : 1 }}).fetch ()
140
+ usersOfMentionIds = _ .pluck (usersOfMention, ' _id' );
141
+ if usersOfMentionIds .length > 0
142
+ Push .send
143
+ from : ' push'
144
+ title : " ##{ room .name } "
145
+ text : message .msg
146
+ apn :
147
+ text : " ##{ room .name } :\n #{ message .msg } "
148
+ badge : 1
149
+ sound : ' chime'
150
+ payload :
151
+ rid : message .rid
152
+ sender : message .u
153
+ query :
154
+ userId : $in : usersOfMentionIds
153
155
154
156
###
155
157
Update all other subscriptions to alert their owners but witout incrementing
0 commit comments