fix(chat): validate group membership, by @phillipthelen

This commit is contained in:
Sabe Jones
2024-06-11 13:14:47 -05:00
parent 758b6138c2
commit 5719e5e996
6 changed files with 68 additions and 2 deletions

View File

@@ -36,7 +36,7 @@ export default class GroupChatReporter extends ChatReporter {
});
if (!group) throw new NotFound(this.res.t('groupNotFound'));
const message = await Chat.findOne({ _id: this.req.params.chatId }).exec();
const message = await Chat.findOne({ _id: this.req.params.chatId, groupId: group._id }).exec();
if (!message) throw new NotFound(this.res.t('messageGroupChatNotFound'));
if (message.uuid === 'system') throw new BadRequest(this.res.t('messageCannotFlagSystemMessages', { communityManagerEmail: COMMUNITY_MANAGER_EMAIL }));