diff options
author | Joas Schilling <coding@schilljs.com> | 2023-01-30 11:06:53 +0100 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2023-01-31 11:25:49 +0100 |
commit | 12b8adaff5e9f3dca4df0b24a20d316c8b66e27e (patch) | |
tree | 3eb197e973ed022c39b90617bb078342464ae98c /lib | |
parent | 7dc878f1899d646c925ee5b073a93430cf3e40d5 (diff) |
Only filter mentions for conversation members
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Collaboration/Collaborators/Listener.php | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/Collaboration/Collaborators/Listener.php b/lib/Collaboration/Collaborators/Listener.php index 2f9603942..fdca86a18 100644 --- a/lib/Collaboration/Collaborators/Listener.php +++ b/lib/Collaboration/Collaborators/Listener.php @@ -32,6 +32,7 @@ use OCA\Talk\Model\Attendee; use OCA\Talk\Participant; use OCA\Talk\Room; use OCA\Talk\Service\ParticipantService; +use OCA\Talk\TalkSession; use OCP\Collaboration\AutoComplete\AutoCompleteEvent; use OCP\Collaboration\AutoComplete\IManager; use OCP\EventDispatcher\IEventDispatcher; @@ -44,19 +45,25 @@ class Listener { protected IUserManager $userManager; protected ParticipantService $participantService; protected Config $config; + protected TalkSession $talkSession; /** @var string[] */ protected array $allowedGroupIds = []; protected string $roomToken; protected ?Room $room = null; + protected ?string $userId; public function __construct(Manager $manager, IUserManager $userManager, ParticipantService $participantService, - Config $config) { + Config $config, + TalkSession $talkSession, + ?string $userId) { $this->manager = $manager; $this->userManager = $userManager; $this->participantService = $participantService; + $this->talkSession = $talkSession; $this->config = $config; + $this->userId = $userId; } public static function register(IEventDispatcher $dispatcher): void { @@ -122,10 +129,14 @@ class Listener { } protected function filterExistingParticipants(string $token, array $results): array { + $sessionId = $this->talkSession->getSessionForRoom($token); try { - $this->room = $this->manager->getRoomByToken($token); + $this->room = $this->manager->getRoomForUserByToken($token, $this->userId); + $this->participantService->getParticipant($this->room, $this->userId, $sessionId); } catch (RoomNotFoundException $e) { return $results; + } catch (ParticipantNotFoundException $e) { + return $results; } if (!empty($results['groups'])) { |