diff --git a/actions/apsharedinbox.php b/actions/apsharedinbox.php index 02d63a7..81aa469 100755 --- a/actions/apsharedinbox.php +++ b/actions/apsharedinbox.php @@ -91,32 +91,35 @@ class apSharedInboxAction extends ManagedAction // Process request switch ($data->type) { - case "Create": - require_once __DIR__ . DIRECTORY_SEPARATOR . "inbox" . DIRECTORY_SEPARATOR . "Create.php"; - break; - case "Follow": - require_once __DIR__ . DIRECTORY_SEPARATOR . "inbox" . DIRECTORY_SEPARATOR . "Follow.php"; - break; - case "Like": - require_once __DIR__ . DIRECTORY_SEPARATOR . "inbox" . DIRECTORY_SEPARATOR . "Like.php"; - break; - case "Announce": - require_once __DIR__ . DIRECTORY_SEPARATOR . "inbox" . DIRECTORY_SEPARATOR . "Announce.php"; - break; - case "Undo": - require_once __DIR__ . DIRECTORY_SEPARATOR . "inbox" . DIRECTORY_SEPARATOR . "Undo.php"; - break; - case "Delete": - require_once __DIR__ . DIRECTORY_SEPARATOR . "inbox" . DIRECTORY_SEPARATOR . "Delete.php"; - break; - case "Accept": - require_once __DIR__ . DIRECTORY_SEPARATOR . "inbox" . DIRECTORY_SEPARATOR . "Accept.php"; - break; - case "Reject": - require_once __DIR__ . DIRECTORY_SEPARATOR . "inbox" . DIRECTORY_SEPARATOR . "Reject.php"; - break; - default: - ActivityPubReturn::error("Invalid type value."); - } + // Data available: + // Profile $actor_profile + // string|object $data->object + case "Create": + require_once __DIR__ . DIRECTORY_SEPARATOR . "inbox" . DIRECTORY_SEPARATOR . "Create.php"; + break; + case "Follow": + require_once __DIR__ . DIRECTORY_SEPARATOR . "inbox" . DIRECTORY_SEPARATOR . "Follow.php"; + break; + case "Like": + require_once __DIR__ . DIRECTORY_SEPARATOR . "inbox" . DIRECTORY_SEPARATOR . "Like.php"; + break; + case "Announce": + require_once __DIR__ . DIRECTORY_SEPARATOR . "inbox" . DIRECTORY_SEPARATOR . "Announce.php"; + break; + case "Undo": + require_once __DIR__ . DIRECTORY_SEPARATOR . "inbox" . DIRECTORY_SEPARATOR . "Undo.php"; + break; + case "Delete": + require_once __DIR__ . DIRECTORY_SEPARATOR . "inbox" . DIRECTORY_SEPARATOR . "Delete.php"; + break; + case "Accept": + require_once __DIR__ . DIRECTORY_SEPARATOR . "inbox" . DIRECTORY_SEPARATOR . "Accept.php"; + break; + case "Reject": + require_once __DIR__ . DIRECTORY_SEPARATOR . "inbox" . DIRECTORY_SEPARATOR . "Reject.php"; + break; + default: + ActivityPubReturn::error("Invalid type value."); + } } } diff --git a/actions/inbox/Announce.php b/actions/inbox/Announce.php index a3b9b65..9e29f80 100755 --- a/actions/inbox/Announce.php +++ b/actions/inbox/Announce.php @@ -30,8 +30,12 @@ if (!defined('GNUSOCIAL')) { } try { - ActivityPubPlugin::get_local_notice_from_url($data->object->id)->repeat($actor_profile, "ActivityPub"); - ActivityPubReturn::answer("Notice repeated successfully."); + if (isset($data->object->id)) { + ActivityPubPlugin::get_local_notice_from_url($data->object->id)->repeat($actor_profile, "ActivityPub"); + ActivityPubReturn::answer("Notice repeated successfully."); + } else { + ActivityPubReturn::error('No object id was specified.'); + } } catch (Exception $e) { ActivityPubReturn::error($e->getMessage(), 403); }