Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/spreed.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2020-10-29 16:15:31 +0300
committerJoas Schilling <coding@schilljs.com>2020-10-30 12:38:53 +0300
commitfcc296acb17aad14e041eccbd8e1ca3037ccc2ae (patch)
tree3e7db1fab4b08b6b26e2571cd7d9a82c898e328b /lib/Service
parent6996121c23afc68850d4e83c8f7fdae587dccecb (diff)
Add an endpoint to delete a participant by attendee id
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/Service')
-rw-r--r--lib/Service/ParticipantService.php18
1 files changed, 15 insertions, 3 deletions
diff --git a/lib/Service/ParticipantService.php b/lib/Service/ParticipantService.php
index 7a22a20e1..293092c93 100644
--- a/lib/Service/ParticipantService.php
+++ b/lib/Service/ParticipantService.php
@@ -290,13 +290,25 @@ class ParticipantService {
}
public function removeAttendee(Room $room, Participant $participant, string $reason): void {
- $event = new RemoveParticipantEvent($room, $participant, $reason);
- $this->dispatcher->dispatch(Room::EVENT_BEFORE_PARTICIPANT_REMOVE, $event);
+ $isUser = $participant->getAttendee()->getActorType() === 'users';
+
+ if ($isUser) {
+ $user = $this->userManager->get($participant->getAttendee()->getActorId());
+ $event = new RemoveUserEvent($room, $participant, $user, $reason);
+ $this->dispatcher->dispatch(Room::EVENT_BEFORE_USER_REMOVE, $event);
+ } else {
+ $event = new RemoveParticipantEvent($room, $participant, $reason);
+ $this->dispatcher->dispatch(Room::EVENT_BEFORE_PARTICIPANT_REMOVE, $event);
+ }
$this->sessionMapper->deleteByAttendeeId($participant->getAttendee()->getId());
$this->attendeeMapper->delete($participant->getAttendee());
- $this->dispatcher->dispatch(Room::EVENT_AFTER_PARTICIPANT_REMOVE, $event);
+ if ($isUser) {
+ $this->dispatcher->dispatch(Room::EVENT_AFTER_USER_REMOVE, $event);
+ } else {
+ $this->dispatcher->dispatch(Room::EVENT_AFTER_PARTICIPANT_REMOVE, $event);
+ }
}
public function removeUser(Room $room, IUser $user, string $reason): void {