fully sync party on system messages

This commit is contained in:
Matteo Pagliazzi
2016-09-07 16:39:53 +02:00
parent fd00543a8d
commit a4ecdbeb3e
2 changed files with 31 additions and 5 deletions
+6
View File
@@ -351,6 +351,12 @@ schema.methods.sendChat = function sendChat (message, user) {
User.update(query, lastSeenUpdate, {multi: true}).exec();
// If the message being sent is a system message (not gone through the api.postChat controller)
// then notify Pusher about it (only parties for now)
if (newMessage.uuid === 'system' && this.privacy === 'private' && this.type === 'party') {
pusher.trigger(`presence-group-${this._id}`, 'new-chat', newMessage);
}
return newMessage;
};