Skip to content

Commit

Permalink
fix(moderator): Allow promoting self-joined participants to moderators
Browse files Browse the repository at this point in the history
Signed-off-by: Joas Schilling <[email protected]>
  • Loading branch information
nickvergessen authored and backportbot[bot] committed Jan 8, 2025
1 parent d041d24 commit 68e7d3b
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/Controller/RoomController.php
Original file line number Diff line number Diff line change
Expand Up @@ -1839,7 +1839,8 @@ protected function changeParticipantType(int $attendeeId, bool $promote): DataRe
return new DataResponse([], Http::STATUS_BAD_REQUEST);
}

if ($attendee->getParticipantType() === Participant::USER) {
if ($attendee->getParticipantType() === Participant::USER
|| $attendee->getParticipantType() === Participant::USER_SELF_JOINED) {
$newType = Participant::MODERATOR;
} elseif ($attendee->getParticipantType() === Participant::GUEST) {
$newType = Participant::GUEST_MODERATOR;
Expand Down
2 changes: 1 addition & 1 deletion lib/Service/ParticipantService.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ public function updateParticipantType(Room $room, Participant $participant, int

$this->attendeeMapper->update($attendee);

// XOR so we don't move the participant in and out when they are changed from moderator to owner or vice-versa
// XOR so we don't move the participant in and out when they are changed from moderator to owner or vice versa
if (($promotedToModerator xor $demotedFromModerator) && $room->getBreakoutRoomMode() !== BreakoutRoom::MODE_NOT_CONFIGURED) {
/** @var Manager $manager */
$manager = Server::get(Manager::class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,24 @@ Feature: conversation-2/promotion-demotion
| users | participant2 | SJLAVPM |
| users | participant3 | SJAVPM |

Scenario: Moderator promotes self-joined user
Given user "participant1" creates room "room" (v4)
| roomType | 3 |
| roomName | room |
And user "participant2" joins room "room" with 200 (v4)
And user "participant2" is participant of the following rooms (v4)
| id | type | participantType |
| room | 3 | 5 |
And user "participant1" loads attendees attendee ids in room "room" (v4)
And user "participant1" promotes "participant2" in room "room" with 200 (v4)
And user "participant2" is participant of the following rooms (v4)
| id | type | participantType |
| room | 3 | 2 |
When user "participant1" demotes "participant2" in room "room" with 200 (v4)
Then user "participant2" is participant of the following rooms (v4)
| id | type | participantType |
| room | 3 | 3 |

Scenario: User promotes/demotes moderator
Given user "participant1" creates room "room" (v4)
| roomType | 3 |
Expand Down

0 comments on commit 68e7d3b

Please sign in to comment.