we now have got an uri-id field for the contact table

This commit is contained in:
Michael 2021-07-08 18:59:58 +00:00
parent 178bc543e3
commit 901c3f4855
5 changed files with 102 additions and 87 deletions

View file

@ -185,6 +185,12 @@ class Contact
$fields['gsid'] = GServer::getID($fields['baseurl'], true);
}
if (!empty($fields['url']) && !empty($fields['guid'])) {
$fields['uri-id'] = ItemURI::insert(['uri' => $fields['url'], 'guid' => $fields['guid']]);
} elseif (!empty($fields['url'])) {
$fields['uri-id'] = ItemURI::getIdByURI($fields['url']);
}
if (empty($fields['created'])) {
$fields['created'] = DateTimeFormat::utcNow();
}
@ -2144,9 +2150,10 @@ class Contact
return true;
}
$ret['nurl'] = Strings::normaliseLink($ret['url']);
$ret['nurl'] = Strings::normaliseLink($ret['url']);
$ret['uri-id'] = ItemURI::getIdByURI($ret['url']);
$ret['updated'] = $updated;
$ret['failed'] = false;
$ret['failed'] = false;
// Only fill the pubkey if it had been empty before. We have to prevent identity theft.
if (empty($pubkey) && !empty($new_pubkey)) {

View file

@ -111,7 +111,7 @@ class Account extends BaseDataTransferObject
$created = $userContactCreated < $publicContactCreated && ($userContactCreated != DBA::NULL_DATETIME) ? $userContactCreated : $publicContactCreated;
$this->created_at = DateTimeFormat::utc($created, DateTimeFormat::JSON);
$this->note = BBCode::convert($publicContact['about'], false);
$this->note = BBCode::convertForItem($publicContact['uri-id'] ?? 0, $publicContact['about'], BBCode::API);
$this->url = $publicContact['url'];
$this->avatar = Contact::getAvatarUrlForId($userContact['id'] ?? 0 ?: $publicContact['id'], Proxy::SIZE_SMALL, $userContact['updated'] ?? '' ?: $publicContact['updated']);
$this->avatar_static = $this->avatar;