System messages flaggable (#9408)

* Remove flag from system messages, throw an error if system messages are flagged

* Modify unflag system message test to check if flagging a system message throws an error

* Move email from nconf to top
This commit is contained in:
Paul
2017-11-27 17:45:04 -08:00
committed by Sabe Jones
parent 2afd96e11c
commit 885f2998ae
4 changed files with 15 additions and 11 deletions

View File

@@ -22,6 +22,7 @@ const FLAG_REPORT_EMAILS = nconf.get('FLAG_REPORT_EMAIL').split(',').map((email)
return { email, canSend: true };
});
const COMMUNITY_MANAGER_EMAIL = nconf.get('EMAILS:COMMUNITY_MANAGER_EMAIL');
/**
* @apiDefine MessageNotFound
* @apiError (404) {NotFound} MessageNotFound The specified message could not be found.
@@ -320,7 +321,7 @@ api.flagChat = {
let message = _.find(group.chat, {id: req.params.chatId});
if (!message) throw new NotFound(res.t('messageGroupChatNotFound'));
if (message.uuid === 'system') throw new BadRequest(res.t('messageCannotFlagSystemMessages', {communityManagerEmail: COMMUNITY_MANAGER_EMAIL}));
let update = {$set: {}};
// Log user ids that have flagged the message