Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(reactions): Fix reacting to people that left #8883

Merged
merged 1 commit into from
Feb 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 6 additions & 1 deletion lib/Chat/Notifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,12 @@ public function notifyReacted(Room $chat, IComment $comment, IComment $reaction)
return;
}

$participant = $this->participantService->getParticipant($chat, $comment->getActorId(), false);
try {
$participant = $this->participantService->getParticipant($chat, $comment->getActorId(), false);
} catch (ParticipantNotFoundException $e) {
return;
}

$notificationLevel = $participant->getAttendee()->getNotificationLevel();
if ($notificationLevel === Participant::NOTIFY_DEFAULT) {
if ($chat->getType() === Room::TYPE_ONE_TO_ONE) {
Expand Down
17 changes: 17 additions & 0 deletions tests/integration/features/chat-2/reaction.feature
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,23 @@ Feature: chat-2/reaction
| room | users | participant1 | participant1-displayname | user_added |
| room | users | participant1 | participant1-displayname | conversation_created |

Scenario: React to message does not fail when the author left the conversation
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 "participant2" sends message "Message 1" to room "room" with 201
And user "participant2" removes themselves from room "room" with 200 (v4)
And user "participant1" react with "馃憤" on message "Message 1" to room "room" with 201
| actorType | actorId | actorDisplayName | reaction |
| users | participant1 | participant1-displayname | 馃憤 |
Then user "participant1" sees the following system messages in room "room" with 200
| room | actorType | actorId | actorDisplayName | systemMessage |
| room | users | participant1 | participant1-displayname | reaction |
| room | users | participant2 | participant2-displayname | user_removed |
| room | users | participant1 | participant1-displayname | user_added |
| room | users | participant1 | participant1-displayname | conversation_created |

Scenario: Delete reaction to message with success
Given user "participant1" creates room "room" (v4)
| roomType | 3 |
Expand Down