fix error code

This commit is contained in:
Matteo Pagliazzi
2013-09-08 18:02:28 +02:00
parent 8fde22c0c4
commit bfe7aec583
+2 -2
View File
@@ -171,11 +171,11 @@ api.deleteChatMessage = function(req, res, next){
var group = res.locals.group;
var message = _.find(group.chat, {id: req.params.messageId, uuid: user.id});
if(message === undefined) return res.json(500, {err: "Message not found!"});
if(message === undefined) return res.json(404, {err: "Message not found!"});
if(user.id !== message.uuid){
if(!user.backer || (user.backer && !user.backer.admin)){
return res.json(500, {err: "Not authorized to delete this message!"})
return res.json(401, {err: "Not authorized to delete this message!"})
}
}