Skip to content

Commit

Permalink
Fix removing yourself and promoting a stranger
Browse files Browse the repository at this point in the history
Signed-off-by: Joas Schilling <coding@schilljs.com>
  • Loading branch information
nickvergessen committed Mar 9, 2021
1 parent 12a48be commit 1e9c21e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
3 changes: 1 addition & 2 deletions lib/Controller/RoomController.php
Original file line number Diff line number Diff line change
Expand Up @@ -1189,8 +1189,7 @@ public function removeAttendeeFromRoom(int $attendeeId): DataResponse {
}

if ($this->participant->getAttendee()->getId() === $targetParticipant->getAttendee()->getId()) {
// FIXME switch to removeSelfFromRoomLogic()
return new DataResponse([], Http::STATUS_FORBIDDEN);
return $this->removeSelfFromRoomLogic($this->room, $targetParticipant);
}

if ($targetParticipant->getAttendee()->getParticipantType() === Participant::OWNER) {
Expand Down
4 changes: 3 additions & 1 deletion tests/integration/features/bootstrap/FeatureContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -1010,7 +1010,9 @@ public function userAddAttendeeToRoom(string $user, string $newType, string $new
* @param string $apiVersion
*/
public function userPromoteDemoteInRoom(string $user, string $isPromotion, string $participant, string $identifier, int $statusCode, string $apiVersion): void {
if (strpos($participant, 'guest') === 0) {
if ($participant === 'stranger') {
$attendeeId = 123456789;
} elseif (strpos($participant, 'guest') === 0) {
$sessionId = self::$userToSessionId[$participant];
$attendeeId = $this->getAttendeeId('guests', sha1($sessionId), $identifier, $statusCode === 200 ? $user : null);
} else {
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/features/conversation/one-to-one.feature
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ Feature: one-to-one
And user "participant1" is participant of room "room10" (v4)
And user "participant3" is not participant of room "room10" (v4)
And user "participant1" loads attendees attendee ids in room "room10" (v4)
When user "participant1" promotes "participant3" in room "room10" with 404 (v4)
When user "participant1" promotes "stranger" in room "room10" with 404 (v4)

Scenario: User1 invites user2 to a one2one room and demote non-invited user
Given user "participant1" creates room "room11" (v4)
Expand All @@ -134,7 +134,7 @@ Feature: one-to-one
And user "participant1" is participant of room "room11" (v4)
And user "participant3" is not participant of room "room11" (v4)
And user "participant1" loads attendees attendee ids in room "room11" (v4)
When user "participant1" demotes "participant3" in room "room11" with 404 (v4)
When user "participant1" demotes "stranger" in room "room11" with 404 (v4)

Scenario: User1 invites user2 to a one2one room twice, it's the same room
Given user "participant1" creates room "room12" (v4)
Expand Down

0 comments on commit 1e9c21e

Please sign in to comment.