mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-25 15:55:22 +00:00
Update StatusTransformer, generate autolink on request
This commit is contained in:
parent
9677791bef
commit
dfe2379b93
2 changed files with 6 additions and 2 deletions
|
@ -16,6 +16,7 @@ use App\Services\StatusLabelService;
|
|||
use App\Services\StatusMentionService;
|
||||
use App\Services\PollService;
|
||||
use App\Models\CustomEmoji;
|
||||
use App\Util\Lexer\Autolink;
|
||||
|
||||
class StatusStatelessTransformer extends Fractal\TransformerAbstract
|
||||
{
|
||||
|
@ -23,6 +24,7 @@ class StatusStatelessTransformer extends Fractal\TransformerAbstract
|
|||
{
|
||||
$taggedPeople = MediaTagService::get($status->id);
|
||||
$poll = $status->type === 'poll' ? PollService::get($status->id) : null;
|
||||
$rendered = $status->caption ? Autolink::create()->autolink($status->caption) : null;
|
||||
|
||||
return [
|
||||
'_v' => 1,
|
||||
|
@ -34,7 +36,7 @@ class StatusStatelessTransformer extends Fractal\TransformerAbstract
|
|||
'in_reply_to_id' => $status->in_reply_to_id ? (string) $status->in_reply_to_id : null,
|
||||
'in_reply_to_account_id' => $status->in_reply_to_profile_id ? (string) $status->in_reply_to_profile_id : null,
|
||||
'reblog' => $status->reblog_of_id ? StatusService::get($status->reblog_of_id, false) : null,
|
||||
'content' => $status->rendered ?? $status->caption,
|
||||
'content' => $rendered,
|
||||
'content_text' => $status->caption,
|
||||
'created_at' => str_replace('+00:00', 'Z', $status->created_at->format(DATE_RFC3339_EXTENDED)),
|
||||
'emojis' => CustomEmoji::scan($status->caption),
|
||||
|
|
|
@ -19,6 +19,7 @@ use Illuminate\Support\Str;
|
|||
use App\Services\PollService;
|
||||
use App\Models\CustomEmoji;
|
||||
use App\Services\BookmarkService;
|
||||
use App\Util\Lexer\Autolink;
|
||||
|
||||
class StatusTransformer extends Fractal\TransformerAbstract
|
||||
{
|
||||
|
@ -27,6 +28,7 @@ class StatusTransformer extends Fractal\TransformerAbstract
|
|||
$pid = request()->user()->profile_id;
|
||||
$taggedPeople = MediaTagService::get($status->id);
|
||||
$poll = $status->type === 'poll' ? PollService::get($status->id, $pid) : null;
|
||||
$rendered = $status->caption ? Autolink::create()->autolink($status->caption) : null;
|
||||
|
||||
return [
|
||||
'_v' => 1,
|
||||
|
@ -37,7 +39,7 @@ class StatusTransformer extends Fractal\TransformerAbstract
|
|||
'in_reply_to_id' => (string) $status->in_reply_to_id,
|
||||
'in_reply_to_account_id' => (string) $status->in_reply_to_profile_id,
|
||||
'reblog' => $status->reblog_of_id ? StatusService::get($status->reblog_of_id) : null,
|
||||
'content' => $status->rendered ?? $status->caption,
|
||||
'content' => $rendered,
|
||||
'content_text' => $status->caption,
|
||||
'created_at' => str_replace('+00:00', 'Z', $status->created_at->format(DATE_RFC3339_EXTENDED)),
|
||||
'emojis' => CustomEmoji::scan($status->caption),
|
||||
|
|
Loading…
Reference in a new issue