mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-25 15:55:22 +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 League\Fractal;
|
||||
use Cache;
|
||||
use App\Services\HashidService;
|
||||
use App\Services\MediaTagService;
|
||||
|
||||
class StatusTransformer extends Fractal\TransformerAbstract
|
||||
{
|
||||
|
@ -15,12 +17,15 @@ class StatusTransformer extends Fractal\TransformerAbstract
|
|||
|
||||
public function transform(Status $status)
|
||||
{
|
||||
$taggedPeople = MediaTagService::get($status->id);
|
||||
|
||||
return [
|
||||
'id' => (string) $status->id,
|
||||
'shortcode' => HashidService::encode($status->id),
|
||||
'uri' => $status->url(),
|
||||
'url' => $status->url(),
|
||||
'in_reply_to_id' => $status->in_reply_to_id,
|
||||
'in_reply_to_account_id' => $status->in_reply_to_profile_id,
|
||||
'in_reply_to_id' => (string) $status->in_reply_to_id,
|
||||
'in_reply_to_account_id' => (string) $status->in_reply_to_profile_id,
|
||||
'reblog' => null,
|
||||
'content' => $status->rendered ?? $status->caption,
|
||||
'content_text' => $status->caption,
|
||||
|
@ -50,6 +55,7 @@ class StatusTransformer extends Fractal\TransformerAbstract
|
|||
'parent' => [],
|
||||
'place' => $status->place,
|
||||
'local' => (bool) $status->local,
|
||||
'taggedPeople' => $taggedPeople
|
||||
];
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue