From b4b64dcf19098682a95ea42ef850dc5c4dc52c8b Mon Sep 17 00:00:00 2001 From: Sabe Jones Date: Fri, 12 Feb 2016 13:18:30 -0500 Subject: [PATCH] fix(performance): no chat notifs from big Guilds --- website/src/models/group.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/website/src/models/group.js b/website/src/models/group.js index b699164c73..f9ca8a04d3 100644 --- a/website/src/models/group.js +++ b/website/src/models/group.js @@ -155,7 +155,7 @@ var chatDefaults = module.exports.chatDefaults = function(msg,user){ return message; } -var NO_CHAT_NOTIFICATIONS = ['habitrpg', '5481ccf3-5d2d-48a9-a871-70a7380cee5a'] +var NO_CHAT_NOTIFICATIONS = ['habitrpg'] GroupSchema.methods.sendChat = function(message, user){ var group = this; @@ -164,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 (NO_CHAT_NOTIFICATIONS.indexOf(group._id) !== -1) { + if (NO_CHAT_NOTIFICATIONS.indexOf(group._id) !== -1 || group.memberCount > 5000) { // 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();