[ActivityPub] Fix issues concerning Activity URIs

And some other minor bugs.
This commit is contained in:
Diogo Cordeiro
2020-08-28 01:12:40 +01:00
parent 11ebb98919
commit c75bf1a19d
13 changed files with 169 additions and 67 deletions

View File

@@ -43,11 +43,11 @@ class Activitypub_undo
* @param array $object
* @return array pretty array to be used in a response
*/
public static function undo_to_array($object)
public static function undo_to_array(array $object): array
{
$res = [
'@context' => 'https://www.w3.org/ns/activitystreams',
'id' => $object['id'].'/undo',
'id' => $object['id'] . '#undo',
'type' => 'Undo',
'actor' => $object['actor'],
'object' => $object
@@ -63,7 +63,7 @@ class Activitypub_undo
* @throws Exception
* @author Diogo Cordeiro <diogo@fc.up.pt>
*/
public static function validate_object($object)
public static function validate_object(array $object): bool
{
if (!is_array($object)) {
throw new Exception('Invalid Object Format for Undo Activity.');