summaryrefslogtreecommitdiffstats
path: root/lib/private/Collaboration
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2018-02-14 11:53:48 +0100
committerGitHub <noreply@github.com>2018-02-14 11:53:48 +0100
commita966d5256c14a9481dcf4d23c2b0b7466183e8e8 (patch)
tree05de0d48aaf7cce4da6fe83ebf74167b25d69193 /lib/private/Collaboration
parentc32a94b78d36aace3237d5b0c6c4069976ff06ad (diff)
parentcf216ecff2e09f713d5b37206d61ea7476ea1f37 (diff)
downloadnextcloud-server-a966d5256c14a9481dcf4d23c2b0b7466183e8e8.tar.gz
nextcloud-server-a966d5256c14a9481dcf4d23c2b0b7466183e8e8.zip
Merge pull request #8328 from nextcloud/bugfix/noid/filter-out-the-current-user-by-email-too
Filter out the current user when searching for emails too
Diffstat (limited to 'lib/private/Collaboration')
-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;
+ }
}