Added method for letting an admin unhide a flagged message
This commit is contained in:
@@ -285,6 +285,23 @@ api.flagChatMessage = function(req, res, next){
|
||||
});
|
||||
}
|
||||
|
||||
api.clearFlagCount = function(req, res, next){
|
||||
var user = res.locals.user
|
||||
var group = res.locals.group;
|
||||
var message = _.find(group.chat, {id: req.params.mid});
|
||||
|
||||
if(!message) return res.json(404, {err: "Message not found!"});
|
||||
|
||||
if(user.contributor.admin)
|
||||
message.flagCount = 0;
|
||||
|
||||
group.markModified('chat');
|
||||
group.save(function(err,_saved){
|
||||
if(err) return next(err);
|
||||
return res.send(204);
|
||||
});
|
||||
}
|
||||
|
||||
api.seenMessage = function(req,res,next){
|
||||
// Skip the auth step, we want this to be fast. If !found with uuid/token, then it just doesn't save
|
||||
// Check for req.params.gid to exist
|
||||
|
||||
@@ -588,6 +588,17 @@ module.exports = (swagger, v2) ->
|
||||
middleware: [auth.auth, i18n.getUserLanguage, groups.attachGroup]
|
||||
action: groups.flagChatMessage
|
||||
|
||||
"/groups/{gid}/chat/{mid}/clearflags":
|
||||
spec:
|
||||
method: 'POST'
|
||||
description: "Clear flag count from message and unhide it"
|
||||
parameters: [
|
||||
path 'gid','Group id','string'
|
||||
path 'mid','Message id','string'
|
||||
]
|
||||
middleware: [auth.auth, i18n.getUserLanguage, groups.attachGroup]
|
||||
action: groups.clearFlagCount
|
||||
|
||||
# ---------------------------------
|
||||
# Members
|
||||
# ---------------------------------
|
||||
|
||||
Reference in New Issue
Block a user