Skip to content

Commit

Permalink
Merge pull request #11027 from nextcloud/backport/11026/stable28
Browse files Browse the repository at this point in the history
[stable28] Fix undefined $participant when calling a lobbied room
  • Loading branch information
nickvergessen committed Nov 29, 2023
2 parents 90e1238 + 2e9f3a9 commit 5b5868e
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 4 deletions.
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 |

0 comments on commit 5b5868e

Please sign in to comment.