diff --git a/lib/Controller/RoomController.php b/lib/Controller/RoomController.php index d44f836762c..1ab9551ca79 100644 --- a/lib/Controller/RoomController.php +++ b/lib/Controller/RoomController.php @@ -1994,7 +1994,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; diff --git a/lib/Service/ParticipantService.php b/lib/Service/ParticipantService.php index 82513679996..6a5f8a5c431 100644 --- a/lib/Service/ParticipantService.php +++ b/lib/Service/ParticipantService.php @@ -151,7 +151,7 @@ public function updateParticipantType(Room $room, Participant $participant, int $attendee->setLastAttendeeActivity($this->timeFactory->getTime()); $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); diff --git a/tests/integration/features/conversation-4/promotion-demotion.feature b/tests/integration/features/conversation-4/promotion-demotion.feature index 9913f479cf5..19474890436 100644 --- a/tests/integration/features/conversation-4/promotion-demotion.feature +++ b/tests/integration/features/conversation-4/promotion-demotion.feature @@ -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 |