diff options
author | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2018-01-18 14:20:26 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-18 14:20:26 +0100 |
commit | a0499e02585d8f1e0c4547fdfaee7551bfafe4c4 (patch) | |
tree | dc2849b992c364eb7f6554482b5ef98ea2e91428 /lib | |
parent | 266c64069fb300d79f253a1bdd2e249e78330d50 (diff) | |
parent | 92bc33dd1e2eedd408add076a4f0a37257542951 (diff) | |
download | nextcloud-server-a0499e02585d8f1e0c4547fdfaee7551bfafe4c4.tar.gz nextcloud-server-a0499e02585d8f1e0c4547fdfaee7551bfafe4c4.zip |
Merge pull request #7932 from nextcloud/7914-stable13
[stable13] 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; |