diff options
author | Joas Schilling <coding@schilljs.com> | 2022-10-04 12:08:48 +0200 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2022-10-04 16:02:08 +0200 |
commit | 5f060687c8a0c77f1a61bf9a3462d4bfa4fe055f (patch) | |
tree | d86425eae0d2a3b3bee11262e5c3b2a52645bd89 /lib/Search | |
parent | aac298148e1cac88c1437e016f2ffe4f7e24d8d0 (diff) |
Move getParticipant()
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/Search')
-rw-r--r-- | lib/Search/CurrentMessageSearch.php | 2 | ||||
-rw-r--r-- | lib/Search/MessageSearch.php | 8 |
2 files changed, 7 insertions, 3 deletions
diff --git a/lib/Search/CurrentMessageSearch.php b/lib/Search/CurrentMessageSearch.php index 126099aa5..d15c1a9e5 100644 --- a/lib/Search/CurrentMessageSearch.php +++ b/lib/Search/CurrentMessageSearch.php @@ -90,7 +90,7 @@ class CurrentMessageSearch extends MessageSearch { } try { - $participant = $room->getParticipant($user->getUID(), false); + $participant = $this->participantService->getParticipant($room, $user->getUID(), false); } catch (ParticipantNotFoundException $e) { return SearchResult::complete( $this->l->t('Messages'), diff --git a/lib/Search/MessageSearch.php b/lib/Search/MessageSearch.php index 6ac0dfc3f..e10bfc49d 100644 --- a/lib/Search/MessageSearch.php +++ b/lib/Search/MessageSearch.php @@ -31,6 +31,7 @@ use OCA\Talk\Exceptions\UnauthorizedException; use OCA\Talk\Manager as RoomManager; use OCA\Talk\Model\Attendee; use OCA\Talk\Room; +use OCA\Talk\Service\ParticipantService; use OCA\Talk\Webinary; use OCP\Comments\IComment; use OCP\IL10N; @@ -43,6 +44,7 @@ use OCP\Search\SearchResultEntry; class MessageSearch implements IProvider { protected RoomManager $roomManager; + protected ParticipantService $participantService; protected ChatManager $chatManager; protected MessageParser $messageParser; protected IURLGenerator $url; @@ -50,12 +52,14 @@ class MessageSearch implements IProvider { public function __construct( RoomManager $roomManager, + ParticipantService $participantService, ChatManager $chatManager, MessageParser $messageParser, IURLGenerator $url, IL10N $l ) { $this->roomManager = $roomManager; + $this->participantService = $participantService; $this->chatManager = $chatManager; $this->messageParser = $messageParser; $this->url = $url; @@ -122,7 +126,7 @@ class MessageSearch implements IProvider { } if ($room->getLobbyState() !== Webinary::LOBBY_NONE) { - $participant = $room->getParticipant($user->getUID(), false); + $participant = $this->participantService->getParticipant($room, $user->getUID(), false); if (!($participant->getPermissions() & Attendee::PERMISSIONS_LOBBY_IGNORE)) { continue; } @@ -165,7 +169,7 @@ class MessageSearch implements IProvider { } protected function commentToSearchResultEntry(Room $room, IUser $user, IComment $comment, ISearchQuery $query): SearchResultEntry { - $participant = $room->getParticipant($user->getUID(), false); + $participant = $this->participantService->getParticipant($room, $user->getUID(), false); $id = (int) $comment->getId(); $message = $this->messageParser->createMessage($room, $participant, $comment, $this->l); |