mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-29 09:43:16 +00:00
Add UndoAnnounce transformer
This commit is contained in:
parent
c9d1c8e937
commit
3ba31bdc7c
1 changed files with 31 additions and 0 deletions
31
app/Transformer/ActivityPub/Verb/UndoAnnounce.php
Normal file
31
app/Transformer/ActivityPub/Verb/UndoAnnounce.php
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Transformer\ActivityPub\Verb;
|
||||||
|
|
||||||
|
use App\Status;
|
||||||
|
use League\Fractal;
|
||||||
|
|
||||||
|
class UndoAnnounce extends Fractal\TransformerAbstract
|
||||||
|
{
|
||||||
|
public function transform(Status $status)
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'@context' => 'https://www.w3.org/ns/activitystreams',
|
||||||
|
'id' => $status->permalink('/undo'),
|
||||||
|
'actor' => $status->profile->permalink(),
|
||||||
|
'type' => 'Undo',
|
||||||
|
'object' => [
|
||||||
|
'id' => $status->permalink(),
|
||||||
|
'type' => 'Announce',
|
||||||
|
'actor' => $status->profile->permalink(),
|
||||||
|
'to' => ['https://www.w3.org/ns/activitystreams#Public'],
|
||||||
|
'cc' => [
|
||||||
|
$status->profile->permalink(),
|
||||||
|
$status->profile->follower_url ?? $status->profile->permalink('/followers')
|
||||||
|
],
|
||||||
|
'published' => $status->created_at->format(DATE_ISO8601),
|
||||||
|
'object' => $status->parent()->url(),
|
||||||
|
]
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue