diff --git a/lib/private/Collaboration/Collaborators/UserPlugin.php b/lib/private/Collaboration/Collaborators/UserPlugin.php index 62f7687603163..971b702556473 100644 --- a/lib/private/Collaboration/Collaborators/UserPlugin.php +++ b/lib/private/Collaboration/Collaborators/UserPlugin.php @@ -79,7 +79,9 @@ public function search($search, $limit, $offset, ISearchResult $searchResult) { $usersTmp = $this->userManager->searchDisplayName($search, $limit, $offset); foreach ($usersTmp as $user) { - $users[$user->getUID()] = $user->getDisplayName(); + if ($user->isEnabled()) { // Don't keep deactivated users + $users[$user->getUID()] = $user->getDisplayName(); + } } } diff --git a/tests/lib/Collaboration/Collaborators/UserPluginTest.php b/tests/lib/Collaboration/Collaborators/UserPluginTest.php index cfb97de867634..7513f9da5b67b 100644 --- a/tests/lib/Collaboration/Collaborators/UserPluginTest.php +++ b/tests/lib/Collaboration/Collaborators/UserPluginTest.php @@ -89,7 +89,7 @@ public function instantiatePlugin() { ); } - public function getUserMock($uid, $displayName) { + public function getUserMock($uid, $displayName, $enabled = true) { $user = $this->createMock(IUser::class); $user->expects($this->any()) @@ -100,6 +100,10 @@ public function getUserMock($uid, $displayName) { ->method('getDisplayName') ->willReturn($displayName); + $user->expects($this->any()) + ->method('isEnabled') + ->willReturn($enabled); + return $user; }