]> git.mxchange.org Git - friendica.git/commitdiff
Always use the oldest creation data
authorMichael <heluecht@pirati.ca>
Wed, 2 Sep 2020 04:17:13 +0000 (04:17 +0000)
committerMichael <heluecht@pirati.ca>
Wed, 2 Sep 2020 04:17:13 +0000 (04:17 +0000)
src/Object/Api/Mastodon/Account.php

index 517fb152ba9d2e2c34cdf8d32e1b375188737fa6..5bd2743b9e0cb9acb0e724c95dec11682a989d11 100644 (file)
@@ -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'];