UndoAnnounce.php 822 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. namespace App\Transformer\ActivityPub\Verb;
  3. use App\Status;
  4. use League\Fractal;
  5. class UndoAnnounce extends Fractal\TransformerAbstract
  6. {
  7. public function transform(Status $status)
  8. {
  9. return [
  10. '@context' => 'https://www.w3.org/ns/activitystreams',
  11. 'id' => $status->permalink('/undo'),
  12. 'actor' => $status->profile->permalink(),
  13. 'type' => 'Undo',
  14. 'object' => [
  15. 'id' => $status->permalink(),
  16. 'type' => 'Announce',
  17. 'actor' => $status->profile->permalink(),
  18. 'to' => ['https://www.w3.org/ns/activitystreams#Public'],
  19. 'cc' => [
  20. $status->profile->permalink(),
  21. $status->profile->follower_url ?? $status->profile->permalink('/followers')
  22. ],
  23. 'published' => $status->created_at->format(DATE_ISO8601),
  24. 'object' => $status->parent()->url(),
  25. ]
  26. ];
  27. }
  28. }