diff options
author | Roeland Jago Douma <rullzer@users.noreply.github.com> | 2018-01-17 14:59:46 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-17 14:59:46 +0100 |
commit | 6e29b8731e25526442d9b878a5a6ae75afc4075e (patch) | |
tree | c946269570feb61b63387cdf0919dabcbd1d15e2 /lib | |
parent | 24c58d39f4238f1068c629937a1a2baa37214068 (diff) | |
parent | 39f34603f20103a5fc44425175bf271e3fc91207 (diff) | |
download | nextcloud-server-6e29b8731e25526442d9b878a5a6ae75afc4075e.tar.gz nextcloud-server-6e29b8731e25526442d9b878a5a6ae75afc4075e.zip |
Merge pull request #7914 from nextcloud/fix-7254
format self-mentions, but don't offer them
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/Collaboration/Collaborators/Search.php | 9 | ||||
-rw-r--r-- | lib/private/Collaboration/Collaborators/UserPlugin.php | 11 | ||||
-rw-r--r-- | lib/private/Comments/Comment.php | 4 |
3 files changed, 20 insertions, 4 deletions
diff --git a/lib/private/Collaboration/Collaborators/Search.php b/lib/private/Collaboration/Collaborators/Search.php index e9b15dd1201..bb1bd6d1711 100644 --- a/lib/private/Collaboration/Collaborators/Search.php +++ b/lib/private/Collaboration/Collaborators/Search.php @@ -40,6 +40,15 @@ class Search implements ISearch { $this->c = $c; } + /** + * @param string $search + * @param array $shareTypes + * @param bool $lookup + * @param int|null $limit + * @param int|null $offset + * @return array + * @throws \OCP\AppFramework\QueryException + */ public function search($search, array $shareTypes, $lookup, $limit, $offset) { $hasMoreResults = false; diff --git a/lib/private/Collaboration/Collaborators/UserPlugin.php b/lib/private/Collaboration/Collaborators/UserPlugin.php index 86a55aa428f..ad677703547 100644 --- a/lib/private/Collaboration/Collaborators/UserPlugin.php +++ b/lib/private/Collaboration/Collaborators/UserPlugin.php @@ -83,6 +83,8 @@ class UserPlugin implements ISearchPlugin { } } + $this->takeOutCurrentUser($users); + if (!$this->shareeEnumeration || sizeof($users) < $limit) { $hasMoreResults = true; } @@ -146,4 +148,13 @@ class UserPlugin implements ISearchPlugin { return $hasMoreResults; } + + public function takeOutCurrentUser(array &$users) { + $currentUser = $this->userSession->getUser(); + if(!is_null($currentUser)) { + if (isset($users[$currentUser->getUID()])) { + unset($users[$currentUser->getUID()]); + } + } + } } diff --git a/lib/private/Comments/Comment.php b/lib/private/Comments/Comment.php index acfebd32028..dd790c2e50a 100644 --- a/lib/private/Comments/Comment.php +++ b/lib/private/Comments/Comment.php @@ -232,10 +232,6 @@ class Comment implements IComment { $uids = array_unique($mentions[0]); $result = []; foreach ($uids as $uid) { - // exclude author, no self-mentioning - if($uid === '@' . $this->getActorId()) { - continue; - } $result[] = ['type' => 'user', 'id' => substr($uid, 1)]; } return $result; |