[ActivityPub] Ensuring notice deletion

ActivityPubPlugin:
- Minor onDeleteOwnNotice rewrite

Activitypub_inbox_handler:
- Add deletion check to incoming notice

Activitypub_postman:
- Call the correct getUrl function
This commit is contained in:
brunoccast
2019-07-25 03:29:11 +01:00
committed by Diogo Peralta Cordeiro
parent 87423a0191
commit 9de1c34bc0
3 changed files with 35 additions and 23 deletions

View File

@@ -213,8 +213,19 @@ class Activitypub_inbox_handler
*/
private function handle_delete($actor, $object)
{
$notice = ActivityPubPlugin::grab_notice_from_url($object['object']);
$notice->deleteAs($actor);
// some moderator could already have deleted the
// notice, so we test it first
try {
$found = Deleted_notice::getByUri($object);
$deleted = ($found instanceof Deleted_notice);
} catch (NoResultException $e) {
$deleted = false;
}
if (!$deleted) {
$notice = ActivityPubPlugin::grab_notice_from_url($object);
$notice->deleteAs($actor);
}
}
/**