[ActivityPub] Fix handling of Delete Activity

inbox_handler:
- Call stronger validation method for Delete Activity objects
- Take into account mixed object in handle_delete

Activitypub_delete:
- Add validation method for Delete Activity objects
This commit is contained in:
tenma
2019-08-08 17:21:56 +01:00
committed by Diogo Peralta Cordeiro
parent 489cab0f87
commit b4b5d3e009
2 changed files with 40 additions and 5 deletions

View File

@@ -96,6 +96,8 @@ class Activitypub_inbox_handler
Activitypub_create::validate_object($this->object);
break;
case 'Delete':
Activitypub_delete::validate_object($this->object);
break;
case 'Follow':
case 'Like':
case 'Announce':
@@ -207,12 +209,16 @@ class Activitypub_inbox_handler
* Handles a Delete Activity received by our inbox.
*
* @param Profile $actor Actor
* @param array $object Activity
* @param array|string $object Activity's object
* @throws AuthorizationException
* @author Diogo Cordeiro <diogo@fc.up.pt>
*/
private function handle_delete($actor, $object)
private function handle_delete(Profile $actor, $object)
{
if (is_array($object)) {
$object = $object['id'];
}
// some moderator could already have deleted the
// notice, so we test it first
try {