summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2018-02-13 17:32:58 +0100
committerJoas Schilling <coding@schilljs.com>2018-02-13 17:32:58 +0100
commitcf216ecff2e09f713d5b37206d61ea7476ea1f37 (patch)
tree18a06c47254b6e32e157bd9748893327d52d7cea /lib
parent91c67eb667b2c049f0fcbe8fd868f6a689aaf26e (diff)
downloadnextcloud-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.php11
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;
+ }
}