mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-12-01 18:53:16 +00:00
Update StatusTransformer, add tagged and shortcode fields
This commit is contained in:
parent
78f37273e9
commit
6e507a553a
1 changed files with 8 additions and 2 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 StatusTransformer extends Fractal\TransformerAbstract
|
class StatusTransformer extends Fractal\TransformerAbstract
|
||||||
{
|
{
|
||||||
|
@ -15,12 +17,15 @@ class StatusTransformer 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' => (string) $status->in_reply_to_id,
|
||||||
'in_reply_to_account_id' => $status->in_reply_to_profile_id,
|
'in_reply_to_account_id' => (string) $status->in_reply_to_profile_id,
|
||||||
'reblog' => null,
|
'reblog' => null,
|
||||||
'content' => $status->rendered ?? $status->caption,
|
'content' => $status->rendered ?? $status->caption,
|
||||||
'content_text' => $status->caption,
|
'content_text' => $status->caption,
|
||||||
|
@ -50,6 +55,7 @@ class StatusTransformer extends Fractal\TransformerAbstract
|
||||||
'parent' => [],
|
'parent' => [],
|
||||||
'place' => $status->place,
|
'place' => $status->place,
|
||||||
'local' => (bool) $status->local,
|
'local' => (bool) $status->local,
|
||||||
|
'taggedPeople' => $taggedPeople
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue