Update Transformers to comply with MastoAPI

This commit is contained in:
Daniel Supernault 2024-12-06 03:23:55 -07:00
parent 79039ba595
commit 1f30beccf3
No known key found for this signature in database
GPG key ID: 23740873EE6F76A1
6 changed files with 6 additions and 6 deletions

View file

@ -11,7 +11,7 @@ class StatusTransformer extends Fractal\TransformerAbstract
{
public function transform(Status $status)
{
$content = $status->caption ? nl2br(Autolink::create()->autolink($status->caption)) : null;
$content = $status->caption ? nl2br(Autolink::create()->autolink($status->caption)) : "";
return [
'@context' => [

View file

@ -52,7 +52,7 @@ class CreateNote extends Fractal\TransformerAbstract
$emojis = CustomEmoji::scan($status->caption, true) ?? [];
$emoji = array_merge($emojis, $mentions);
$tags = array_merge($emoji, $hashtags);
$content = $status->caption ? nl2br(Autolink::create()->autolink($status->caption)) : null;
$content = $status->caption ? nl2br(Autolink::create()->autolink($status->caption)) : "";
return [
'@context' => [

View file

@ -53,7 +53,7 @@ class Note extends Fractal\TransformerAbstract
$emojis = CustomEmoji::scan($status->caption, true) ?? [];
$emoji = array_merge($emojis, $mentions);
$tags = array_merge($emoji, $hashtags);
$content = $status->caption ? nl2br(Autolink::create()->autolink($status->caption)) : null;
$content = $status->caption ? nl2br(Autolink::create()->autolink($status->caption)) : "";
return [
'@context' => [

View file

@ -53,7 +53,7 @@ class UpdateNote extends Fractal\TransformerAbstract
$emoji = array_merge($emojis, $mentions);
$tags = array_merge($emoji, $hashtags);
$content = $status->caption ? nl2br(Autolink::create()->autolink($status->caption)) : null;
$content = $status->caption ? nl2br(Autolink::create()->autolink($status->caption)) : "";
$latestEdit = $status->edits()->latest()->first();
return [

View file

@ -13,7 +13,7 @@ class StatusTransformer extends Fractal\TransformerAbstract
{
public function transform(Status $status)
{
$content = $status->caption ? nl2br(Autolink::create()->autolink($status->caption)) : null;
$content = $status->caption ? nl2br(Autolink::create()->autolink($status->caption)) : "";
return [
'id' => (string) $status->id,

View file

@ -25,7 +25,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;
$content = $status->caption ? nl2br(Autolink::create()->autolink($status->caption)) : null;
$content = $status->caption ? nl2br(Autolink::create()->autolink($status->caption)) : "";
return [
'_v' => 1,