From 840245010167e85d663df66e5745875909bc4a13 Mon Sep 17 00:00:00 2001 From: Michael Date: Wed, 2 Sep 2020 04:17:13 +0000 Subject: [PATCH] Always use the oldest creation data --- src/Object/Api/Mastodon/Account.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Object/Api/Mastodon/Account.php b/src/Object/Api/Mastodon/Account.php index 517fb152ba..5bd2743b9e 100644 --- a/src/Object/Api/Mastodon/Account.php +++ b/src/Object/Api/Mastodon/Account.php @@ -103,7 +103,13 @@ class Account extends BaseEntity $this->bot = ($publicContact['contact-type'] == Contact::TYPE_NEWS); $this->discoverable = !$publicContact['unsearchable']; $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->url = $publicContact['url']; $this->avatar = $userContact['avatar'] ?? $publicContact['avatar'];