Skip to content

Commit 7f0f9fc

Browse files
authored
Merge pull request #26081 from nextcloud/backport/26080/stable21
[stable21] Only clear known users when we had at least one phonebook entry
2 parents 3ac6dc3 + 3efb2d2 commit 7f0f9fc

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

apps/provisioning_api/lib/Controller/UsersController.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -239,9 +239,6 @@ public function searchByPhoneNumbers(string $location, array $search): DataRespo
239239
$user = $this->userSession->getUser();
240240
$knownTo = $user->getUID();
241241

242-
// Cleanup all previous entries and only allow new matches
243-
$this->knownUserService->deleteKnownTo($knownTo);
244-
245242
$normalizedNumberToKey = [];
246243
foreach ($search as $key => $phoneNumbers) {
247244
foreach ($phoneNumbers as $phone) {
@@ -262,6 +259,9 @@ public function searchByPhoneNumbers(string $location, array $search): DataRespo
262259
return new DataResponse();
263260
}
264261

262+
// Cleanup all previous entries and only allow new matches
263+
$this->knownUserService->deleteKnownTo($knownTo);
264+
265265
$userMatches = $this->accountManager->searchUsers(IAccountManager::PROPERTY_PHONE, $phoneNumbers);
266266

267267
if (empty($userMatches)) {

0 commit comments

Comments
 (0)