fix(flag-message): small refactor

This commit is contained in:
Matteo Pagliazzi
2014-12-12 11:39:22 +01:00
parent ac34332582
commit 948d5762cd
+10 -6
View File
@@ -292,14 +292,18 @@ api.clearFlagCount = function(req, res, next){
if(!message) return res.json(404, {err: "Message not found!"});
if(user.contributor.admin)
if(user.contributor.admin){
message.flagCount = 0;
group.markModified('chat');
group.save(function(err,_saved){
if(err) return next(err);
return res.send(204);
});
}else{
return res.json(401, {err: "Only an admin can clear the flag count!"})
}
group.markModified('chat');
group.save(function(err,_saved){
if(err) return next(err);
return res.send(204);
});
}
api.seenMessage = function(req,res,next){