diff --git a/lib/Chat/Parser/SystemMessage.php b/lib/Chat/Parser/SystemMessage.php index dd4aa7b1c72..a92b1954c80 100644 --- a/lib/Chat/Parser/SystemMessage.php +++ b/lib/Chat/Parser/SystemMessage.php @@ -497,6 +497,9 @@ public function parseDeletedMessage(Message $chatMessage): void { throw new \OutOfBoundsException('Unknown subject'); } + // Overwrite reactions of deleted messages as you can not react to them anymore either + $chatMessage->getComment()->setReactions([]); + $chatMessage->setMessage($parsedMessage, $parsedParameters, $message); } diff --git a/tests/integration/features/reaction/react.feature b/tests/integration/features/reaction/react.feature index 7dcfa52aaa1..f7c796bf103 100644 --- a/tests/integration/features/reaction/react.feature +++ b/tests/integration/features/reaction/react.feature @@ -111,3 +111,20 @@ Feature: reaction/react | users | participant1 | participant1-displayname | 👍 | | users | participant2 | participant2-displayname | 👎 | | users | participant2 | participant2-displayname | 👍 | + + Scenario: Delete message that was reacted to + Given user "participant1" creates room "room" (v4) + | roomType | 3 | + | roomName | room | + And user "participant1" adds user "participant2" to room "room" with 200 (v4) + And user "participant1" sends message "Message 1" to room "room" with 201 + And user "participant2" react with "👍" on message "Message 1" to room "room" with 201 + | actorType | actorId | actorDisplayName | reaction | + | users | participant2 | participant2-displayname | 👍 | + And user "participant1" sees the following messages in room "room" with 200 + | room | actorType | actorId | actorDisplayName | message | messageParameters | reactions | + | room | users | participant1 | participant1-displayname | Message 1 | [] | {"👍":1} | + Then user "participant1" deletes message "Message 1" from room "room" with 200 (v1) + And user "participant1" sees the following messages in room "room" with 200 + | room | actorType | actorId | actorDisplayName | message | messageParameters | reactions | + | room | users | participant1 | participant1-displayname | Message deleted by you | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} | [] |