Do not return an error message when attepting to create a repeated notice

This commit is contained in:
Diogo Cordeiro 2018-08-03 00:41:08 +01:00
parent aa491271f7
commit 2b98344bc4
3 changed files with 9 additions and 5 deletions

View File

@ -33,10 +33,10 @@ if (!defined('GNUSOCIAL')) {
date_default_timezone_set('UTC'); date_default_timezone_set('UTC');
// Import required files by the plugin // Import required files by the plugin
require __DIR__.'/vendor/autoload.php'; require_once __DIR__ . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php';
require_once __DIR__ . DIRECTORY_SEPARATOR . "utils" . DIRECTORY_SEPARATOR . "discoveryhints.php"; require_once __DIR__ . DIRECTORY_SEPARATOR . 'utils' . DIRECTORY_SEPARATOR . 'discoveryhints.php';
require_once __DIR__ . DIRECTORY_SEPARATOR . "utils" . DIRECTORY_SEPARATOR . "explorer.php"; require_once __DIR__ . DIRECTORY_SEPARATOR . 'utils' . DIRECTORY_SEPARATOR . 'explorer.php';
require_once __DIR__ . DIRECTORY_SEPARATOR . "utils" . DIRECTORY_SEPARATOR . "postman.php"; require_once __DIR__ . DIRECTORY_SEPARATOR . 'utils' . DIRECTORY_SEPARATOR . 'postman.php';
// So that this isn't hardcoded everywhere // So that this isn't hardcoded everywhere
define('ACTIVITYPUB_BASE_ACTOR_URI', common_root_url().'index.php/user/'); define('ACTIVITYPUB_BASE_ACTOR_URI', common_root_url().'index.php/user/');

View File

@ -62,6 +62,10 @@ try {
$settings $settings
); );
ActivityPubReturn::answer(); ActivityPubReturn::answer();
} catch (AlreadyFulfilledException $e) {
// Notice URI already exists
common_debug('ActivityPub Inbox Create Note: Note already exists: '.$e->getMessage());
ActivityPubReturn::answer();
} catch (Exception $e) { } catch (Exception $e) {
common_debug('ActivityPub Inbox Create Note: Failed Create Note: '.$e->getMessage()); common_debug('ActivityPub Inbox Create Note: Failed Create Note: '.$e->getMessage());
ActivityPubReturn::error($e->getMessage()); ActivityPubReturn::error($e->getMessage());

View File

@ -193,7 +193,7 @@ class Activitypub_notice extends Managed_DataObject
try { try {
return Notice::saveActivity($act, $actor_profile, $options); return Notice::saveActivity($act, $actor_profile, $options);
} catch (Exception $e) { } catch (Exception $e) {
throw new Exception($e->getMessage()); throw $e;
} }
} }