mirror of
https://github.com/chatmail/core.git
synced 2026-05-01 20:36:31 +03:00
feat: Contact::lookup_id_by_addr_ex: Prefer returning key-contact
If an address-contact and a key-contact were seen at exactly the same time, that doesn't necessarily mean that it's a random event, it might occur because some code updates contacts this way in some scenario. While this is unlikely, prefer to look up the key-contact.
This commit is contained in:
@@ -808,7 +808,7 @@ impl Contact {
|
||||
"SELECT id FROM contacts
|
||||
WHERE addr=?1 COLLATE NOCASE
|
||||
AND id>?2 AND origin>=?3 AND (? OR blocked=?)
|
||||
ORDER BY last_seen DESC LIMIT 1",
|
||||
ORDER BY last_seen DESC, fingerprint DESC LIMIT 1",
|
||||
(
|
||||
&addr_normalized,
|
||||
ContactId::LAST_SPECIAL,
|
||||
|
||||
Reference in New Issue
Block a user