Skip to content

Commit 8261d7e

Browse files
authored
Merge pull request #20772 from nextcloud/fix/sharee-integration-test
Properly search for users when limittogroups is enabled
2 parents 7c30b61 + a0cbf16 commit 8261d7e

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

lib/private/Collaboration/Collaborators/UserPlugin.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,15 @@ public function search($search, $limit, $offset, ISearchResult $searchResult) {
9595
$usersInGroup = $this->groupManager->displayNamesInGroup($userGroupId, $search, $limit, $offset);
9696
foreach ($usersInGroup as $userId => $displayName) {
9797
$userId = (string) $userId;
98-
$users[$userId] = $this->userManager->get($userId);
98+
$user = $this->userManager->get($userId);
99+
if (!$user->isEnabled()) {
100+
// Ignore disabled users
101+
continue;
102+
}
103+
$users[$userId] = $user;
104+
}
105+
if (count($usersInGroup) >= $limit) {
106+
$hasMoreResults = true;
99107
}
100108
}
101109
} else {

tests/lib/Collaboration/Collaborators/UserPluginTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ public function dataGetUsers() {
328328
['label' => 'Test One', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test1'], 'status' => []],
329329
['label' => 'Test Two', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test2'], 'status' => []],
330330
],
331-
false,
331+
true,
332332
false,
333333
[
334334
['test1', $this->getUserMock('test1', 'Test One')],

0 commit comments

Comments
 (0)