Update mastodon api transformers, fix timestamps

This commit is contained in:
Daniel Supernault 2019-09-26 20:15:49 -06:00
parent be7eae8494
commit 5ff4ba0807
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7
2 changed files with 2 additions and 2 deletions

View file

@ -19,7 +19,7 @@ class AccountTransformer extends Fractal\TransformerAbstract
'acct' => $acct, 'acct' => $acct,
'display_name' => $profile->name, 'display_name' => $profile->name,
'locked' => (bool) $profile->is_private, 'locked' => (bool) $profile->is_private,
'created_at' => $profile->created_at->format('c'), 'created_at' => $profile->created_at->toIso8601ZuluString(),
'followers_count' => $profile->followerCount(), 'followers_count' => $profile->followerCount(),
'following_count' => $profile->followingCount(), 'following_count' => $profile->followingCount(),
'statuses_count' => (int) $profile->statusCount(), 'statuses_count' => (int) $profile->statusCount(),

View file

@ -25,7 +25,7 @@ class StatusTransformer extends Fractal\TransformerAbstract
'in_reply_to_account_id' => $status->in_reply_to_profile_id, 'in_reply_to_account_id' => $status->in_reply_to_profile_id,
'reblog' => null, 'reblog' => null,
'content' => $status->rendered ?? $status->caption, 'content' => $status->rendered ?? $status->caption,
'created_at' => $status->created_at->format('c'), 'created_at' => $status->created_at->toIso8601ZuluString(),
'emojis' => [], 'emojis' => [],
'reblogs_count' => $status->reblogs_count != 0 ? $status->reblogs_count: $status->shares()->count(), 'reblogs_count' => $status->reblogs_count != 0 ? $status->reblogs_count: $status->shares()->count(),
'favourites_count' => $status->likes_count != 0 ? $status->likes_count: $status->likes()->count(), 'favourites_count' => $status->likes_count != 0 ? $status->likes_count: $status->likes()->count(),