summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorVitor Mattos <vitor@php.rio>2023-02-01 11:07:18 -0300
committerGitHub <noreply@github.com>2023-02-01 11:07:18 -0300
commitdf25d5ec4acbdddee6292ba90ad3cea0b689591d (patch)
tree0546465cb018dbe4daa3b093634f2c78367f0380 /lib
parente9aa7d109dd2c87a57b4c678c0235a0299073e51 (diff)
parent12b8adaff5e9f3dca4df0b24a20d316c8b66e27e (diff)
Merge pull request #8651 from nextcloud/bugfix/noid/only-filter-attendees-when-being-a-member
Only filter mentions for conversation members
Diffstat (limited to 'lib')
-rw-r--r--lib/Collaboration/Collaborators/Listener.php15
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'])) {