mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-29 09:43:16 +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 App\Status;
|
||||||
use League\Fractal;
|
use League\Fractal;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
class CreateNote extends Fractal\TransformerAbstract
|
class CreateNote extends Fractal\TransformerAbstract
|
||||||
{
|
{
|
||||||
|
@ -11,10 +12,14 @@ class CreateNote extends Fractal\TransformerAbstract
|
||||||
{
|
{
|
||||||
|
|
||||||
$mentions = $status->mentions->map(function ($mention) {
|
$mentions = $status->mentions->map(function ($mention) {
|
||||||
|
$webfinger = $mention->emailUrl();
|
||||||
|
$name = Str::startsWith($webfinger, '@') ?
|
||||||
|
$webfinger :
|
||||||
|
'@' . $webfinger;
|
||||||
return [
|
return [
|
||||||
'type' => 'Mention',
|
'type' => 'Mention',
|
||||||
'href' => $mention->permalink(),
|
'href' => $mention->permalink(),
|
||||||
'name' => $mention->emailUrl()
|
'name' => $name
|
||||||
];
|
];
|
||||||
})->toArray();
|
})->toArray();
|
||||||
$hashtags = $status->hashtags->map(function ($hashtag) {
|
$hashtags = $status->hashtags->map(function ($hashtag) {
|
||||||
|
|
|
@ -4,6 +4,7 @@ namespace App\Transformer\ActivityPub\Verb;
|
||||||
|
|
||||||
use App\Status;
|
use App\Status;
|
||||||
use League\Fractal;
|
use League\Fractal;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
class Note extends Fractal\TransformerAbstract
|
class Note extends Fractal\TransformerAbstract
|
||||||
{
|
{
|
||||||
|
@ -11,10 +12,14 @@ class Note extends Fractal\TransformerAbstract
|
||||||
{
|
{
|
||||||
|
|
||||||
$mentions = $status->mentions->map(function ($mention) {
|
$mentions = $status->mentions->map(function ($mention) {
|
||||||
|
$webfinger = $mention->emailUrl();
|
||||||
|
$name = Str::startsWith($webfinger, '@') ?
|
||||||
|
$webfinger :
|
||||||
|
'@' . $webfinger;
|
||||||
return [
|
return [
|
||||||
'type' => 'Mention',
|
'type' => 'Mention',
|
||||||
'href' => $mention->permalink(),
|
'href' => $mention->permalink(),
|
||||||
'name' => $mention->emailUrl()
|
'name' => $name
|
||||||
];
|
];
|
||||||
})->toArray();
|
})->toArray();
|
||||||
$hashtags = $status->hashtags->map(function ($hashtag) {
|
$hashtags = $status->hashtags->map(function ($hashtag) {
|
||||||
|
|
Loading…
Reference in a new issue