From aac82c7b2a1ce276412f636b5cb9adbb36c10efd Mon Sep 17 00:00:00 2001 From: Diogo Cordeiro Date: Wed, 1 Aug 2018 00:50:31 +0100 Subject: [PATCH] Add ID to Like and Undo --- classes/Activitypub_like.php | 1 + classes/Activitypub_undo.php | 15 ++++++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/classes/Activitypub_like.php b/classes/Activitypub_like.php index 7b5f21d..5a392ea 100755 --- a/classes/Activitypub_like.php +++ b/classes/Activitypub_like.php @@ -55,6 +55,7 @@ class Activitypub_like extends Managed_DataObject 'https://www.w3.org/ns/activitystreams', 'https://w3id.org/security/v1' ], + 'id' => common_root_url().'like_from_'.urlencode($actor).'_to_'.urlencode($object), "type" => "Like", "actor" => $actor, "object" => $object diff --git a/classes/Activitypub_undo.php b/classes/Activitypub_undo.php index f3ae011..ba54c79 100755 --- a/classes/Activitypub_undo.php +++ b/classes/Activitypub_undo.php @@ -49,11 +49,16 @@ class Activitypub_undo extends Managed_DataObject */ public static function undo_to_array($object) { - $res = array("@context" => "https://www.w3.org/ns/activitystreams", - "type" => "Undo", - "actor" => $object["actor"], - "object" => $object - ); + $res = [ + '@context' => [ + 'https://www.w3.org/ns/activitystreams', + 'https://w3id.org/security/v1' + ], + 'id' => $object['id'].'/undo', + 'type' => 'Undo', + 'actor' => $object['actor'], + 'object' => $object + ]; return $res; } }