Skip to content

Instantly share code, notes, and snippets.

@lefnire
Created November 25, 2014 20:13
Show Gist options
  • Save lefnire/86659101831476a65b8b to your computer and use it in GitHub Desktop.
Save lefnire/86659101831476a65b8b to your computer and use it in GitHub Desktop.
diff --git a/src/controllers/members.js b/src/controllers/members.js
index 9d30179..05b64be 100644
--- a/src/controllers/members.js
+++ b/src/controllers/members.js
@@ -21,6 +21,7 @@ api.sendPrivateMessage = function(req,res,next){
},
function(member, cb){
if (!member) return cb({code:404, err: 'User not found'});
+ if (member.inbox.optOut && member.contributor.admin) return cb({code:401}, err: "Please report issues to Github");
if (~member.inbox.blocks.indexOf(res.locals.user._id) // can't send message if that user blocked me
|| ~res.locals.user.inbox.blocks.indexOf(member._id) // or if I blocked them
|| member.inbox.optOut) { // or if they've opted out of messaging
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment