From 8b860d6da2c46a17e1d0b07889ff1aecb071dc35 Mon Sep 17 00:00:00 2001 From: Diogo Cordeiro Date: Wed, 1 Aug 2018 17:38:39 +0100 Subject: [PATCH] Proper ActivityPub Return Answers --- actions/inbox/Accept.php | 2 +- actions/inbox/Announce.php | 11 ++++++----- actions/inbox/Create.php | 8 ++------ actions/inbox/Delete.php | 3 +-- actions/inbox/Follow.php | 6 +++--- actions/inbox/Like.php | 4 ++-- actions/inbox/Undo.php | 26 ++++++-------------------- utils/postman.php | 2 +- 8 files changed, 22 insertions(+), 40 deletions(-) diff --git a/actions/inbox/Accept.php b/actions/inbox/Accept.php index 0836322..6372305 100755 --- a/actions/inbox/Accept.php +++ b/actions/inbox/Accept.php @@ -50,7 +50,7 @@ case "Follow": $pending_list = new Activitypub_pending_follow_requests($actor_profile->getID(), $object_profile->getID()); $pending_list->remove(); - ActivityPubReturn::answer($data); // You are now being followed by this person. + ActivityPubReturn::answer(); // You are now being followed by this person. break; default: ActivityPubReturn::error("Invalid object type."); diff --git a/actions/inbox/Announce.php b/actions/inbox/Announce.php index a556ab3..310c926 100755 --- a/actions/inbox/Announce.php +++ b/actions/inbox/Announce.php @@ -30,12 +30,13 @@ if (!defined('GNUSOCIAL')) { } try { - if (isset($data->object)) { - ActivityPubPlugin::get_local_notice_from_url($data->object)->repeat($actor_profile, "ActivityPub"); - ActivityPubReturn::answer("Notice repeated successfully."); - } else { - ActivityPubReturn::error('No object id was specified.'); + try { + $object_notice = ActivityPubPlugin::get_local_notice_from_url($data->object); + } catch (Exception $e) { + ActivityPubReturn::error('Invalid Object specified.'); } + $object_notice->repeat($actor_profile, 'ActivityPub'); + ActivityPubReturn::answer(); } catch (Exception $e) { ActivityPubReturn::error($e->getMessage(), 403); } diff --git a/actions/inbox/Create.php b/actions/inbox/Create.php index d6fee04..c3fb555 100755 --- a/actions/inbox/Create.php +++ b/actions/inbox/Create.php @@ -129,12 +129,8 @@ $actobj->content = strip_tags($content,'