Skip to content

Commit

Permalink
Merge pull request #26081 from nextcloud/backport/26080/stable21
Browse files Browse the repository at this point in the history
[stable21] Only clear known users when we had at least one phonebook entry
  • Loading branch information
rullzer authored Mar 12, 2021
2 parents 3ac6dc3 + 3efb2d2 commit 7f0f9fc
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions apps/provisioning_api/lib/Controller/UsersController.php
Original file line number Diff line number Diff line change
Expand Up @@ -239,9 +239,6 @@ public function searchByPhoneNumbers(string $location, array $search): DataRespo
$user = $this->userSession->getUser();
$knownTo = $user->getUID();

// Cleanup all previous entries and only allow new matches
$this->knownUserService->deleteKnownTo($knownTo);

$normalizedNumberToKey = [];
foreach ($search as $key => $phoneNumbers) {
foreach ($phoneNumbers as $phone) {
Expand All @@ -262,6 +259,9 @@ public function searchByPhoneNumbers(string $location, array $search): DataRespo
return new DataResponse();
}

// Cleanup all previous entries and only allow new matches
$this->knownUserService->deleteKnownTo($knownTo);

$userMatches = $this->accountManager->searchUsers(IAccountManager::PROPERTY_PHONE, $phoneNumbers);

if (empty($userMatches)) {
Expand Down

0 comments on commit 7f0f9fc

Please sign in to comment.