1
0
Fork 0
forked from mirror/pixelfed

Update StatusTransformer, remove unused fields

This commit is contained in:
Daniel Supernault 2019-08-17 23:40:25 -06:00
parent 0d350ea03e
commit 9b82f75183
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -10,9 +10,7 @@ class StatusTransformer extends Fractal\TransformerAbstract
{ {
protected $defaultIncludes = [ protected $defaultIncludes = [
'account', 'account',
'mentions',
'media_attachments', 'media_attachments',
'tags',
]; ];
public function transform(Status $status) public function transform(Status $status)
@ -41,13 +39,15 @@ class StatusTransformer extends Fractal\TransformerAbstract
], ],
'language' => null, 'language' => null,
'pinned' => null, 'pinned' => null,
'mentions' => [],
'tags' => [],
'pf_type' => $status->type ?? $status->setType(), 'pf_type' => $status->type ?? $status->setType(),
'reply_count' => (int) $status->reply_count, 'reply_count' => (int) $status->reply_count,
'comments_disabled' => $status->comments_disabled ? true : false, 'comments_disabled' => $status->comments_disabled ? true : false,
'thread' => false, 'thread' => false,
'replies' => [], 'replies' => [],
'parent' => [], 'parent' => [],
//'place' => $status->place
]; ];
} }
@ -58,13 +58,6 @@ class StatusTransformer extends Fractal\TransformerAbstract
return $this->item($account, new AccountTransformer()); return $this->item($account, new AccountTransformer());
} }
public function includeMentions(Status $status)
{
$mentions = $status->mentions;
return $this->collection($mentions, new MentionTransformer());
}
public function includeMediaAttachments(Status $status) public function includeMediaAttachments(Status $status)
{ {
return Cache::remember('status:transformer:media:attachments:'.$status->id, now()->addDays(14), function() use($status) { return Cache::remember('status:transformer:media:attachments:'.$status->id, now()->addDays(14), function() use($status) {
@ -74,11 +67,4 @@ class StatusTransformer extends Fractal\TransformerAbstract
} }
}); });
} }
public function includeTags(Status $status)
{
$tags = $status->hashtags;
return $this->collection($tags, new HashtagTransformer());
}
} }