mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-22 14:31:26 +00:00
Update AP transformers, fixes #1637
This commit is contained in:
parent
d14ad094c2
commit
ef77de4e05
2 changed files with 12 additions and 2 deletions
|
@ -4,6 +4,7 @@ namespace App\Transformer\ActivityPub\Verb;
|
|||
|
||||
use App\Status;
|
||||
use League\Fractal;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class CreateNote extends Fractal\TransformerAbstract
|
||||
{
|
||||
|
@ -11,10 +12,14 @@ class CreateNote extends Fractal\TransformerAbstract
|
|||
{
|
||||
|
||||
$mentions = $status->mentions->map(function ($mention) {
|
||||
$webfinger = $mention->emailUrl();
|
||||
$name = Str::startsWith($webfinger, '@') ?
|
||||
$webfinger :
|
||||
'@' . $webfinger;
|
||||
return [
|
||||
'type' => 'Mention',
|
||||
'href' => $mention->permalink(),
|
||||
'name' => $mention->emailUrl()
|
||||
'name' => $name
|
||||
];
|
||||
})->toArray();
|
||||
$hashtags = $status->hashtags->map(function ($hashtag) {
|
||||
|
|
|
@ -4,6 +4,7 @@ namespace App\Transformer\ActivityPub\Verb;
|
|||
|
||||
use App\Status;
|
||||
use League\Fractal;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class Note extends Fractal\TransformerAbstract
|
||||
{
|
||||
|
@ -11,10 +12,14 @@ class Note extends Fractal\TransformerAbstract
|
|||
{
|
||||
|
||||
$mentions = $status->mentions->map(function ($mention) {
|
||||
$webfinger = $mention->emailUrl();
|
||||
$name = Str::startsWith($webfinger, '@') ?
|
||||
$webfinger :
|
||||
'@' . $webfinger;
|
||||
return [
|
||||
'type' => 'Mention',
|
||||
'href' => $mention->permalink(),
|
||||
'name' => $mention->emailUrl()
|
||||
'name' => $name
|
||||
];
|
||||
})->toArray();
|
||||
$hashtags = $status->hashtags->map(function ($hashtag) {
|
||||
|
|
Loading…
Reference in a new issue