From 4aa01ee17f1c6b45e8be2e8b0e692a2d1a232de8 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Fri, 27 Dec 2019 12:23:11 -0500 Subject: [PATCH] Use most recent last item date in Mastodon\Account --- src/Api/Mastodon/Account.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Api/Mastodon/Account.php b/src/Api/Mastodon/Account.php index 389a13dd3a..ade6fc03dc 100644 --- a/src/Api/Mastodon/Account.php +++ b/src/Api/Mastodon/Account.php @@ -100,8 +100,11 @@ class Account $account->group = ($publicContact['contact-type'] == Contact::TYPE_COMMUNITY); $account->discoverable = !$publicContact['unsearchable']; - $last_item = $userContact['last-item'] ?? $publicContact['last-item']; - $account->last_status_at = !empty($last_item) ? DateTimeFormat::utc($last_item, DateTimeFormat::ATOM) : null; + $publicContactLastItem = $publicContact['last-item'] ?: DBA::NULL_DATETIME; + $userContactLastItem = $userContact['last-item'] ?? DBA::NULL_DATETIME; + + $lastItem = $userContactLastItem > $publicContactLastItem ? $userContactLastItem : $publicContactLastItem; + $account->last_status_at = $lastItem != DBA::NULL_DATETIME ? DateTimeFormat::utc($lastItem, DateTimeFormat::ATOM) : null; return $account; }