fix(performance): don't send chat notifs for Newbies Guild

This commit is contained in:
Sabe Jones
2016-02-11 21:29:32 -05:00
parent fdd170c977
commit 67929f3a96
+4 -1
View File
@@ -154,6 +154,9 @@ var chatDefaults = module.exports.chatDefaults = function(msg,user){
}
return message;
}
var NO_CHAT_NOTIFICATIONS = ['habitrpg', '5481ccf3-5d2d-48a9-a871-70a7380cee5a']
GroupSchema.methods.sendChat = function(message, user){
var group = this;
group.chat.unshift(chatDefaults(message,user));
@@ -161,7 +164,7 @@ GroupSchema.methods.sendChat = function(message, user){
// Kick off chat notifications in the background.
var lastSeenUpdate = {$set:{}, $inc:{_v:1}};
lastSeenUpdate['$set']['newMessages.'+group._id] = {name:group.name,value:true};
if (group._id == 'habitrpg') {
if (NO_CHAT_NOTIFICATIONS.indexOf(group._id) !== -1) {
// TODO For Tavern, only notify them if their name was mentioned
// var profileNames = [] // get usernames from regex of @xyz. how to handle space-delimited profile names?
// User.update({'profile.name':{$in:profileNames}},lastSeenUpdate,{multi:true}).exec();