mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
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:
@@ -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,
|
||||
},
|
||||
)
|
||||
|
||||
@@ -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:, **)
|
||||
|
||||
Reference in New Issue
Block a user