Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only clear known users when we had at least one phonebook entry #26080

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -240,9 +240,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 @@ -263,6 +260,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