Skip to content

Instantly share code, notes, and snippets.

@lefnire
Created May 14, 2014 21:55
Show Gist options
  • Save lefnire/6aff710f94c4e353e4bd to your computer and use it in GitHub Desktop.
Save lefnire/6aff710f94c4e353e4bd to your computer and use it in GitHub Desktop.
diff --git a/src/controllers/groups.js b/src/controllers/groups.js
index 2d0bd65..82e0c5c 100644
--- a/src/controllers/groups.js
+++ b/src/controllers/groups.js
@@ -216,6 +216,7 @@ api.getChat = function(req, res, next) {
*/
api.postChat = function(req, res, next) {
var user = res.locals.user
+ if (user.flags.chatRevoked) return res.json(401,{err:'Your chat privileges have been revoked.'});
var group = res.locals.group;
var lastClientMsg = req.query.previousMsg;
var chatUpdated = (lastClientMsg && group.chat && group.chat[0] && group.chat[0].id !== lastClientMsg) ? true : false;
diff --git a/src/models/user.js b/src/models/user.js
index 372a30a..fee9c47 100644
--- a/src/models/user.js
+++ b/src/models/user.js
@@ -109,7 +109,8 @@ var UserSchema = new Schema({
mathUpdates: Boolean,
rebirthEnabled: {type: Boolean, 'default': false},
freeRebirth: {type: Boolean, 'default': false},
- levelDrops: {type:Schema.Types.Mixed, 'default':{}}
+ levelDrops: {type:Schema.Types.Mixed, 'default':{}},
+ chatRevoked: Boolean
},
history: {
exp: Array, // [{date: Date, value: Number}], // big peformance issues if these are defined
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment