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

@@ -295,7 +295,7 @@ api.likeChat = {
const group = await Group.getGroup({ user, groupId });
if (!group) throw new NotFound(res.t('groupNotFound'));
const message = await Chat.findOne({ _id: req.params.chatId }).exec();
const message = await Chat.findOne({ _id: req.params.chatId, groupId: group._id }).exec();
if (!message) throw new NotFound(res.t('messageGroupChatNotFound'));
if (!message.likes) message.likes = {};