Skip to content

Commit

Permalink
Leaving with a session as guest is now also not quiting anymore
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 8, 2021
1 parent d972a7e commit f4b7df9
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions lib/Service/ParticipantService.php
Original file line number Diff line number Diff line change
Expand Up @@ -363,13 +363,8 @@ public function ensureOneToOneRoomIsFilled(Room $room): void {
}

public function leaveRoomAsSession(Room $room, Participant $participant): void {
if ($participant->getAttendee()->getActorType() !== Attendee::ACTOR_GUESTS) {
$event = new ParticipantEvent($room, $participant);
$this->dispatcher->dispatch(Room::EVENT_BEFORE_ROOM_DISCONNECT, $event);
} else {
$event = new RemoveParticipantEvent($room, $participant, Room::PARTICIPANT_LEFT);
$this->dispatcher->dispatch(Room::EVENT_BEFORE_PARTICIPANT_REMOVE, $event);
}
$event = new ParticipantEvent($room, $participant);
$this->dispatcher->dispatch(Room::EVENT_BEFORE_ROOM_DISCONNECT, $event);

$session = $participant->getSession();
if ($session instanceof Session) {
Expand All @@ -392,11 +387,7 @@ public function leaveRoomAsSession(Room $room, Participant $participant): void {
$this->attendeeMapper->delete($participant->getAttendee());
}

if ($participant->getAttendee()->getActorType() !== Attendee::ACTOR_GUESTS) {
$this->dispatcher->dispatch(Room::EVENT_AFTER_ROOM_DISCONNECT, $event);
} else {
$this->dispatcher->dispatch(Room::EVENT_AFTER_PARTICIPANT_REMOVE, $event);
}
$this->dispatcher->dispatch(Room::EVENT_AFTER_ROOM_DISCONNECT, $event);
}

public function removeAttendee(Room $room, Participant $participant, string $reason): void {
Expand Down

0 comments on commit f4b7df9

Please sign in to comment.