mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-25 18:19:22 +03:00
Do not save contact if it already exists
Signed-off-by: Akhil <akhil@e.email>
This commit is contained in:
parent
3c7ef4df46
commit
cdaa4b1434
1 changed files with 5 additions and 8 deletions
|
|
@ -117,6 +117,11 @@ class NextcloudAddressBook implements \RainLoop\Providers\AddressBook\AddressBoo
|
|||
continue;
|
||||
}
|
||||
$sEmail = \trim($oEmail->GetEmail(true));
|
||||
$existingResults = $this->contactsManager->search($sEmail, ['EMAIL'], ['strict_search' => true]);
|
||||
|
||||
if (!empty($existingResults)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$properties = [
|
||||
'EMAIL' => $sEmail,
|
||||
|
|
@ -126,14 +131,6 @@ class NextcloudAddressBook implements \RainLoop\Providers\AddressBook\AddressBoo
|
|||
if ('' !== \trim($oEmail->GetDisplayName())) {
|
||||
$properties['FN'] = $oEmail->GetDisplayName();
|
||||
}
|
||||
$existingResults = $this->contactsManager->search($sEmail, ['EMAIL'], ['strict_search' => true]);
|
||||
|
||||
foreach ($existingResults as $contact) {
|
||||
if ($contact['addressbook-key'] === $this->key) {
|
||||
$properties['URI'] = $contact['UID'] . '.vcf';
|
||||
break;
|
||||
}
|
||||
}
|
||||
$this->contactsManager->createOrUpdate($properties, $this->key);
|
||||
}
|
||||
return true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue