From a8bc4893ea70900c46b67f690549a41b841a2ee0 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 15 Feb 2024 17:18:47 +0100 Subject: [PATCH] fixup! feat(chat): Autocomplete for mentions of federated users --- lib/Chat/AutoComplete/SearchPlugin.php | 6 +++++- lib/Files/Util.php | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/Chat/AutoComplete/SearchPlugin.php b/lib/Chat/AutoComplete/SearchPlugin.php index 2d077880a5fc..68e8d27d2c92 100644 --- a/lib/Chat/AutoComplete/SearchPlugin.php +++ b/lib/Chat/AutoComplete/SearchPlugin.php @@ -71,7 +71,11 @@ public function search($search, $limit, $offset, ISearchResult $searchResult): b if ($this->room->getObjectType() === 'file') { $usersWithFileAccess = $this->util->getUsersWithAccessFile($this->room->getObjectId()); if (!empty($usersWithFileAccess)) { - $this->searchUsers($search, $usersWithFileAccess, $searchResult); + $users = []; + foreach ($usersWithFileAccess as $userId) { + $users[$userId] = $this->userManager->getDisplayName($userId) ?? $userId; + } + $this->searchUsers($search, $users, $searchResult); } } diff --git a/lib/Files/Util.php b/lib/Files/Util.php index 9c5f73697aa9..6755d298db27 100644 --- a/lib/Files/Util.php +++ b/lib/Files/Util.php @@ -48,6 +48,9 @@ public function __construct( ) { } + /** + * @return string[] + */ public function getUsersWithAccessFile(string $fileId): array { if (!isset($this->accessLists[$fileId])) { $nodes = $this->rootFolder->getById((int) $fileId);