FIX: prevents user to restore message deleted by staff (#22571)

It could only occur on message created by the user itself and deleted while the user was looking at the channel.

It more generally fix the trash service which was not correctly setting the author of the delete.
This commit is contained in:
Joffrey JAFFEUX
2023-07-13 10:16:15 +02:00
committed by GitHub
parent c996e5502f
commit 32e32f43b5
14 changed files with 178 additions and 47 deletions

View File

@@ -174,6 +174,7 @@ module Chat
type: "delete",
deleted_id: chat_message.id,
deleted_at: chat_message.deleted_at,
deleted_by_id: chat_message.deleted_by_id,
latest_not_deleted_message_id: latest_not_deleted_message_id,
},
)

View File

@@ -50,8 +50,8 @@ module Chat
guardian.can_delete_chat?(message, message.chat_channel.chatable)
end
def trash_message(message:, **)
message.trash!
def trash_message(message:, guardian:, **)
message.trash!(guardian.user)
end
def destroy_notifications(message:, **)