|
@@ -46,12 +46,18 @@ class Activitypub_like
|
|
|
*/
|
|
|
public static function like_to_array(string $actor, Notice $notice): array
|
|
|
{
|
|
|
+ if ($notice->hasParent() && Notice::getByID($notice->reply_to)) {
|
|
|
+ $object = Activitypub_notice::getUri($notice->getParent());
|
|
|
+ } else {
|
|
|
+ // When unlike.
|
|
|
+ $object = Activitypub_notice::getUri($notice);
|
|
|
+ }
|
|
|
$res = [
|
|
|
'@context' => 'https://www.w3.org/ns/activitystreams',
|
|
|
'id' => Activitypub_notice::getUri($notice),
|
|
|
'type' => 'Like',
|
|
|
'actor' => $actor,
|
|
|
- 'object' => Activitypub_notice::getUri($notice->getParent()),
|
|
|
+ 'object' => $object,
|
|
|
];
|
|
|
return $res;
|
|
|
}
|