Always use the oldest creation data

This commit is contained in:
Michael 2020-09-02 04:17:13 +00:00
parent 247d87c4e5
commit 8402450101

View file

@ -103,7 +103,13 @@ class Account extends BaseEntity
$this->bot = ($publicContact['contact-type'] == Contact::TYPE_NEWS); $this->bot = ($publicContact['contact-type'] == Contact::TYPE_NEWS);
$this->discoverable = !$publicContact['unsearchable']; $this->discoverable = !$publicContact['unsearchable'];
$this->group = ($publicContact['contact-type'] == Contact::TYPE_COMMUNITY); $this->group = ($publicContact['contact-type'] == Contact::TYPE_COMMUNITY);
$this->created_at = DateTimeFormat::utc($publicContact['created'], DateTimeFormat::ATOM);
$publicContactCreated = $publicContact['created'] ?: DBA::NULL_DATETIME;
$userContactCreated = $userContact['created'] ?? DBA::NULL_DATETIME;
$created = $userContactCreated < $publicContactCreated && ($userContactCreated != DBA::NULL_DATETIME) ? $userContactCreated : $publicContactCreated;
$this->created_at = DateTimeFormat::utc($created, DateTimeFormat::ATOM);
$this->note = BBCode::convert($publicContact['about'], false); $this->note = BBCode::convert($publicContact['about'], false);
$this->url = $publicContact['url']; $this->url = $publicContact['url'];
$this->avatar = $userContact['avatar'] ?? $publicContact['avatar']; $this->avatar = $userContact['avatar'] ?? $publicContact['avatar'];