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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable28] Fix undefined $participant when calling a lobbied room #11027

Merged
merged 1 commit into from
Nov 29, 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
9 changes: 5 additions & 4 deletions lib/Notification/Notifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ public function prepare(INotification $notification, string $languageCode): INot
// we just looped over the participants to create the notification,
// they can not be removed between these 2 steps, but we can save
// n queries.
$participant = null;
} else {
try {
$participant = $this->getParticipant($room, $userId);
Expand All @@ -248,8 +249,8 @@ public function prepare(INotification $notification, string $languageCode): INot
return $this->parseInvitation($notification, $room, $l);
}
if ($subject === 'call') {
if ($room->getLobbyState() !== Webinary::LOBBY_NONE &&
$participant instanceof Participant &&
if ($participant instanceof Participant &&
$room->getLobbyState() !== Webinary::LOBBY_NONE &&
!($participant->getPermissions() & Attendee::PERMISSIONS_LOBBY_IGNORE)) {
// User is blocked by the lobby, remove notification
throw new AlreadyProcessedException();
Expand All @@ -261,8 +262,8 @@ public function prepare(INotification $notification, string $languageCode): INot
return $this->parseCall($notification, $room, $l);
}
if ($subject === 'reply' || $subject === 'mention' || $subject === 'mention_direct' || $subject === 'mention_group' || $subject === 'mention_all' || $subject === 'chat' || $subject === 'reaction' || $subject === 'reminder') {
if ($room->getLobbyState() !== Webinary::LOBBY_NONE &&
$participant instanceof Participant &&
if ($participant instanceof Participant &&
$room->getLobbyState() !== Webinary::LOBBY_NONE &&
!($participant->getPermissions() & Attendee::PERMISSIONS_LOBBY_IGNORE)) {
// User is blocked by the lobby, remove notification
throw new AlreadyProcessedException();
Expand Down
44 changes: 44 additions & 0 deletions tests/integration/features/callapi/lobby.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
Feature: callapi/lobby
Background:
Given user "participant1" exists
And user "participant2" exists

Scenario: Participant1 calls without lobby
When user "participant1" creates room "room" (v4)
| roomType | 3 |
| roomName | room |
And user "participant1" adds user "participant2" to room "room" with 200 (v4)
Then user "participant1" is participant of room "room" (v4)
And user "participant2" is participant of room "room" (v4)
Then user "participant1" joins room "room" with 200 (v4)
Then user "participant1" joins call "room" with 200 (v4)
Then user "participant2" has the following notifications
| app | object_type | object_id | subject |
| spreed | call | room | A group call has started in room |

Scenario: Participant1 calls while participant2 is blocked by the lobby
When user "participant1" creates room "room" (v4)
| roomType | 3 |
| roomName | room |
And user "participant1" adds user "participant2" to room "room" with 200 (v4)
Then user "participant1" is participant of room "room" (v4)
And user "participant2" is participant of room "room" (v4)
When user "participant1" sets lobby state for room "room" to "non moderators" with 200 (v4)
Then user "participant1" joins room "room" with 200 (v4)
Then user "participant1" joins call "room" with 200 (v4)
Then user "participant2" has the following notifications

Scenario: Participant1 calls while participant2 is moderator
When user "participant1" creates room "room" (v4)
| roomType | 3 |
| roomName | room |
And user "participant1" adds user "participant2" to room "room" with 200 (v4)
Then user "participant1" is participant of room "room" (v4)
And user "participant2" is participant of room "room" (v4)
And user "participant1" promotes "participant2" in room "room" with 200 (v4)
When user "participant1" sets lobby state for room "room" to "non moderators" with 200 (v4)
Then user "participant1" joins room "room" with 200 (v4)
Then user "participant1" joins call "room" with 200 (v4)
Then user "participant2" has the following notifications
| app | object_type | object_id | subject |
| spreed | call | room | A group call has started in room |