Skip to content

Commit

Permalink
fixed deleting from the wrong user (#637)
Browse files Browse the repository at this point in the history
  • Loading branch information
TSlashDreamy authored Nov 17, 2023
1 parent 856adf3 commit 8c8a7c4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion services/message.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ const messageService = {

if (!existingChat) throw createForbiddenError()

const deleteResult = await Message.deleteMany({ chat, 'clearedFor.user': { $exists: true } }).exec()
const deleteResult = await Message.deleteMany({ chat, 'clearedFor.user': { $exists: true, $ne: user } }).exec()

const updateResult = await Message.updateMany(
{ chat, 'clearedFor.user': { $exists: false } },
Expand Down

0 comments on commit 8c8a7c4

Please sign in to comment.