1
0
Fork 0

Merge pull request #8977 from annando/fix-contact-search

Fix: Always search contacts with uid
This commit is contained in:
Hypolite Petovan 2020-08-05 11:59:06 -04:00 committed by GitHub
commit d5ea823365
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1172,17 +1172,12 @@ class Contact
$data['gsid'] = GServer::getID($data['baseurl']); $data['gsid'] = GServer::getID($data['baseurl']);
} }
if (!$contact_id && !empty($data['alias']) && ($data['alias'] != $data['url'])) { if (!$contact_id) {
$contact = self::getByURL($data['alias'], false, ['id']); $urls = [Strings::normaliseLink($url), Strings::normaliseLink($data['url'])];
if (!empty($contact['id'])) { if (!empty($data['alias'])) {
$contact_id = $contact['id']; $urls[] = Strings::normaliseLink($data['alias']);
Logger::info('Fetched id by alias', ['cid' => $contact_id, 'url' => $url, 'probed_url' => $data['url'], 'alias' => $data['alias']]);
} }
} $contact = self::selectFirst(['id'], ['nurl' => $urls, 'uid' => $uid]);
// Possibly there is a contact entry with the probed URL
if (!$contact_id && ($url != $data['url']) && ($url != $data['alias'])) {
$contact = self::getByURL($data['url'], false, ['id']);
if (!empty($contact['id'])) { if (!empty($contact['id'])) {
$contact_id = $contact['id']; $contact_id = $contact['id'];
Logger::info('Fetched id by url', ['cid' => $contact_id, 'url' => $url, 'probed_url' => $data['url'], 'alias' => $data['alias']]); Logger::info('Fetched id by url', ['cid' => $contact_id, 'url' => $url, 'probed_url' => $data['url'], 'alias' => $data['alias']]);