summaryrefslogtreecommitdiffstats
path: root/lib/private
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@users.noreply.github.com>2018-03-06 17:11:49 +0100
committerGitHub <noreply@github.com>2018-03-06 17:11:49 +0100
commita637e0d686a2e0f358074b76ab6e4396906b2f01 (patch)
tree8bfff6cde11be9b3fa0586f3067903bd51725e09 /lib/private
parent56d5eb17feff1f008f6584b24d149fe6e39b7fdc (diff)
parent173388dcd4aa95703d0b6e058159a2364c414efc (diff)
downloadnextcloud-server-a637e0d686a2e0f358074b76ab6e4396906b2f01.tar.gz
nextcloud-server-a637e0d686a2e0f358074b76ab6e4396906b2f01.zip
Merge pull request #8687 from nextcloud/backport/8328/filter-out-the-current-user-by-email-too
[stable13] Filter out the current user when searching for emails too
Diffstat (limited to 'lib/private')
-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 99629f213e1..464b6702066 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' => [
@@ -191,4 +193,9 @@ class MailPlugin implements ISearchPlugin {
return true;
}
+
+ public function isCurrentUser(ICloudId $cloud) {
+ $currentUser = $this->userSession->getUser();
+ return $currentUser instanceof IUser ? $currentUser->getUID() === $cloud->getUser() : false;
+ }
}