forked from mirror/pixelfed
Update StatusTransformer
This commit is contained in:
parent
1f3a5e263b
commit
1c900a4ba4
1 changed files with 6 additions and 3 deletions
|
@ -46,7 +46,8 @@ class StatusTransformer extends Fractal\TransformerAbstract
|
||||||
'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' => $status->parent() ? $this->transform($status->parent()) : [],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,8 +68,10 @@ class StatusTransformer extends Fractal\TransformerAbstract
|
||||||
public function includeMediaAttachments(Status $status)
|
public function includeMediaAttachments(Status $status)
|
||||||
{
|
{
|
||||||
return Cache::remember('status:transformer:media:attachments:'.$status->id, now()->addMinutes(3), function() use($status) {
|
return Cache::remember('status:transformer:media:attachments:'.$status->id, now()->addMinutes(3), function() use($status) {
|
||||||
$media = $status->media()->orderBy('order')->get();
|
if(in_array($status->type, ['photo', 'video'])) {
|
||||||
return $this->collection($media, new MediaTransformer());
|
$media = $status->media()->orderBy('order')->get();
|
||||||
|
return $this->collection($media, new MediaTransformer());
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue