diff options
author | Joas Schilling <coding@schilljs.com> | 2018-02-13 17:32:58 +0100 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2018-02-13 17:32:58 +0100 |
commit | cf216ecff2e09f713d5b37206d61ea7476ea1f37 (patch) | |
tree | 18a06c47254b6e32e157bd9748893327d52d7cea /lib | |
parent | 91c67eb667b2c049f0fcbe8fd868f6a689aaf26e (diff) | |
download | nextcloud-server-cf216ecff2e09f713d5b37206d61ea7476ea1f37.tar.gz nextcloud-server-cf216ecff2e09f713d5b37206d61ea7476ea1f37.zip |
Filter out the current user when searching for emails too
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/Collaboration/Collaborators/MailPlugin.php | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/private/Collaboration/Collaborators/MailPlugin.php b/lib/private/Collaboration/Collaborators/MailPlugin.php index 2e946c4a872..2d85ff334bc 100644 --- a/lib/private/Collaboration/Collaborators/MailPlugin.php +++ b/lib/private/Collaboration/Collaborators/MailPlugin.php @@ -28,9 +28,11 @@ use OCP\Collaboration\Collaborators\ISearchPlugin; use OCP\Collaboration\Collaborators\ISearchResult; use OCP\Collaboration\Collaborators\SearchResultType; use OCP\Contacts\IManager; +use OCP\Federation\ICloudId; use OCP\Federation\ICloudIdManager; use OCP\IConfig; use OCP\IGroupManager; +use OCP\IUser; use OCP\IUserSession; use OCP\Share; @@ -112,7 +114,7 @@ class MailPlugin implements ISearchPlugin { continue; } - if (!$searchResult->hasResult($userType, $cloud->getUser())) { + if (!$this->isCurrentUser($cloud) && !$searchResult->hasResult($userType, $cloud->getUser())) { $singleResult = [[ 'label' => $contact['FN'] . " ($emailAddress)", 'value' => [ @@ -133,7 +135,7 @@ class MailPlugin implements ISearchPlugin { continue; } - if (!$searchResult->hasResult($userType, $cloud->getUser())) { + if (!$this->isCurrentUser($cloud) && !$searchResult->hasResult($userType, $cloud->getUser())) { $singleResult = [[ 'label' => $contact['FN'] . " ($emailAddress)", 'value' => [ @@ -189,4 +191,9 @@ class MailPlugin implements ISearchPlugin { return true; } + + public function isCurrentUser(ICloudId $cloud): bool { + $currentUser = $this->userSession->getUser(); + return $currentUser instanceof IUser ? $currentUser->getUID() === $cloud->getUser() : false; + } } |