mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-26 00:03:16 +00:00
Update StatusStatelessTransformer, add missing attributes
This commit is contained in:
parent
bd321a72f0
commit
4d22426da2
1 changed files with 10 additions and 1 deletions
|
@ -5,6 +5,8 @@ namespace App\Transformer\Api;
|
||||||
use App\Status;
|
use App\Status;
|
||||||
use League\Fractal;
|
use League\Fractal;
|
||||||
use Cache;
|
use Cache;
|
||||||
|
use App\Services\HashidService;
|
||||||
|
use App\Services\MediaTagService;
|
||||||
|
|
||||||
class StatusStatelessTransformer extends Fractal\TransformerAbstract
|
class StatusStatelessTransformer extends Fractal\TransformerAbstract
|
||||||
{
|
{
|
||||||
|
@ -17,8 +19,11 @@ class StatusStatelessTransformer extends Fractal\TransformerAbstract
|
||||||
|
|
||||||
public function transform(Status $status)
|
public function transform(Status $status)
|
||||||
{
|
{
|
||||||
|
$taggedPeople = MediaTagService::get($status->id);
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'id' => (string) $status->id,
|
'id' => (string) $status->id,
|
||||||
|
'shortcode' => HashidService::encode($status->id),
|
||||||
'uri' => $status->url(),
|
'uri' => $status->url(),
|
||||||
'url' => $status->url(),
|
'url' => $status->url(),
|
||||||
'in_reply_to_id' => $status->in_reply_to_id,
|
'in_reply_to_id' => $status->in_reply_to_id,
|
||||||
|
@ -42,13 +47,17 @@ class StatusStatelessTransformer 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' => $status->parent() ? $this->transform($status->parent()) : [],
|
'parent' => [],
|
||||||
|
'place' => $status->place,
|
||||||
'local' => (bool) $status->local,
|
'local' => (bool) $status->local,
|
||||||
|
'taggedPeople' => $taggedPeople
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue