Skip to content

Commit

Permalink
Merge pull request #5257 from nextcloud/techdebt/noid/use-addMessageF…
Browse files Browse the repository at this point in the history
…orAllParticipants-instead-of-looping-manually

Use addMessageForAllParticipants instead of looping manually
  • Loading branch information
nickvergessen authored Feb 24, 2021
2 parents ffeedd1 + 81520a6 commit 847aee9
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions lib/Signaling/Listener.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,16 +100,7 @@ protected static function registerInternalSignaling(IEventDispatcher $dispatcher

/** @var Messages $messages */
$messages = \OC::$server->query(Messages::class);
/** @var ParticipantService $participantService */
$participantService = \OC::$server->query(ParticipantService::class);

$participants = $participantService->getParticipantsForRoom($room);
foreach ($participants as $participant) {
$session = $participant->getSession();
if ($session instanceof Session) {
$messages->addMessage($session->getSessionId(), $session->getSessionId(), 'refresh-participant-list');
}
}
$messages->addMessageForAllParticipants($room, 'refresh-participant-list');
};
$dispatcher->addListener(Room::EVENT_BEFORE_ROOM_DELETE, $listener);
}
Expand Down

0 comments on commit 847aee9

Please sign in to comment.