diff --git a/src/Factory/Api/Mastodon/Status.php b/src/Factory/Api/Mastodon/Status.php index db7c7203dc..c31c211a59 100644 --- a/src/Factory/Api/Mastodon/Status.php +++ b/src/Factory/Api/Mastodon/Status.php @@ -62,11 +62,12 @@ class Status extends BaseFactory $item = Item::selectFirst([], ['uri-id' => $uriId, 'uid' => $uid]); $account = DI::mstdnAccount()->createFromContactId($item['author-id']); - $count = new \Friendica\Object\Api\Mastodon\Status\StatusCounts( + $counts = new \Friendica\Object\Api\Mastodon\Status\Counts( DBA::count('item', ['thr-parent-id' => $uriId, 'uid' => $uid, 'gravity' => GRAVITY_COMMENT]), DBA::count('item', ['thr-parent-id' => $uriId, 'uid' => $uid, 'gravity' => GRAVITY_ACTIVITY, 'vid' => Verb::getID(Activity::ANNOUNCE)]), - DBA::count('item', ['thr-parent-id' => $uriId, 'uid' => $uid, 'gravity' => GRAVITY_ACTIVITY, 'vid' => Verb::getID(Activity::LIKE)])); + DBA::count('item', ['thr-parent-id' => $uriId, 'uid' => $uid, 'gravity' => GRAVITY_ACTIVITY, 'vid' => Verb::getID(Activity::LIKE)]) + ); - return new \Friendica\Object\Api\Mastodon\Status($item, $account, $count); + return new \Friendica\Object\Api\Mastodon\Status($item, $account, $counts); } } diff --git a/src/Object/Api/Mastodon/Status.php b/src/Object/Api/Mastodon/Status.php index a82d100c98..aa26fa1986 100644 --- a/src/Object/Api/Mastodon/Status.php +++ b/src/Object/Api/Mastodon/Status.php @@ -23,7 +23,7 @@ namespace Friendica\Object\Api\Mastodon; use Friendica\BaseEntity; use Friendica\Content\Text\BBCode; -use Friendica\Object\Api\Mastodon\Status\StatusCounts; +use Friendica\Object\Api\Mastodon\Status\Counts; use Friendica\Util\DateTimeFormat; /** @@ -96,7 +96,7 @@ class Status extends BaseEntity * @param array $item * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ - public function __construct(array $item, Account $account, StatusCounts $count) + public function __construct(array $item, Account $account, Counts $counts) { $this->id = (string)$item['uri-id']; $this->created_at = DateTimeFormat::utc($item['created'], DateTimeFormat::ATOM); @@ -115,9 +115,9 @@ class Status extends BaseEntity $this->language = null; $this->uri = $item['uri']; $this->url = $item['plink'] ?? null; - $this->replies_count = $count->__get('replies'); - $this->reblogs_count = $count->__get('reblogs'); - $this->favourites_count = $count->__get('favourites'); + $this->replies_count = $counts->replies; + $this->reblogs_count = $counts->reblogs; + $this->favourites_count = $counts->favourites; $this->favourited = false; $this->reblogged = false; $this->muted = false; diff --git a/src/Object/Api/Mastodon/Status/StatusCounts.php b/src/Object/Api/Mastodon/Status/StatusCounts.php index eb62326dec..feed5cc541 100644 --- a/src/Object/Api/Mastodon/Status/StatusCounts.php +++ b/src/Object/Api/Mastodon/Status/StatusCounts.php @@ -26,7 +26,7 @@ namespace Friendica\Object\Api\Mastodon\Status; * * @see https://docs.joinmastodon.org/entities/status */ -class StatusCounts +class Counts { /** @var int */ protected $replies;