1
0
Fork 0
forked from mirror/pixelfed

Update StatusTransformer, fix missing tags attribute

This commit is contained in:
Daniel Supernault 2021-05-18 19:39:33 -06:00
parent 955696b8a0
commit dac326e949
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7
2 changed files with 16 additions and 0 deletions

View file

@ -15,6 +15,7 @@ class StatusStatelessTransformer extends Fractal\TransformerAbstract
{
protected $defaultIncludes = [
'account',
'tags',
'media_attachments',
];
@ -72,6 +73,13 @@ class StatusStatelessTransformer extends Fractal\TransformerAbstract
return $this->item($account, new AccountTransformer());
}
public function includeTags(Status $status)
{
$tags = $status->hashtags;
return $this->collection($tags, new HashtagTransformer());
}
public function includeMediaAttachments(Status $status)
{
return Cache::remember('status:transformer:media:attachments:'.$status->id, now()->addMinutes(3), function() use($status) {

View file

@ -17,6 +17,7 @@ class StatusTransformer extends Fractal\TransformerAbstract
{
protected $defaultIncludes = [
'account',
'tags',
'media_attachments',
];
@ -74,6 +75,13 @@ class StatusTransformer extends Fractal\TransformerAbstract
return $this->item($account, new AccountTransformer());
}
public function includeTags(Status $status)
{
$tags = $status->hashtags;
return $this->collection($tags, new HashtagTransformer());
}
public function includeMediaAttachments(Status $status)
{
return Cache::remember('status:transformer:media:attachments:'.$status->id, now()->addMinutes(14), function() use($status) {