Skip to content

Commit

Permalink
Only clear known users when we had at least one phonebook entry
Browse files Browse the repository at this point in the history
Signed-off-by: Joas Schilling <coding@schilljs.com>
  • Loading branch information
nickvergessen authored and backportbot[bot] committed Mar 12, 2021
1 parent 6e2f7dd commit 3efb2d2
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 3efb2d2

Please sign in to comment.