Skip to content

Commit

Permalink
Merge pull request #20772 from nextcloud/fix/sharee-integration-test
Browse files Browse the repository at this point in the history
Properly search for users when limittogroups is enabled
  • Loading branch information
MorrisJobke authored Aug 21, 2020
2 parents 7c30b61 + a0cbf16 commit 8261d7e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion lib/private/Collaboration/Collaborators/UserPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,15 @@ public function search($search, $limit, $offset, ISearchResult $searchResult) {
$usersInGroup = $this->groupManager->displayNamesInGroup($userGroupId, $search, $limit, $offset);
foreach ($usersInGroup as $userId => $displayName) {
$userId = (string) $userId;
$users[$userId] = $this->userManager->get($userId);
$user = $this->userManager->get($userId);
if (!$user->isEnabled()) {
// Ignore disabled users
continue;
}
$users[$userId] = $user;
}
if (count($usersInGroup) >= $limit) {
$hasMoreResults = true;
}
}
} else {
Expand Down
2 changes: 1 addition & 1 deletion tests/lib/Collaboration/Collaborators/UserPluginTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ public function dataGetUsers() {
['label' => 'Test One', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test1'], 'status' => []],
['label' => 'Test Two', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test2'], 'status' => []],
],
false,
true,
false,
[
['test1', $this->getUserMock('test1', 'Test One')],
Expand Down

0 comments on commit 8261d7e

Please sign in to comment.