From d4baa253494eacdead974f28919b683de509ab15 Mon Sep 17 00:00:00 2001 From: Michael Date: Wed, 13 Feb 2019 17:23:23 +0000 Subject: [PATCH 1/3] New configuration to disable the automatic mentions removal --- config/defaults.config.php | 4 ++++ src/Protocol/ActivityPub/Processor.php | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/config/defaults.config.php b/config/defaults.config.php index c1ecbb421..8a9bc19b5 100644 --- a/config/defaults.config.php +++ b/config/defaults.config.php @@ -135,6 +135,10 @@ return [ // Disables the check if a mail address is in a valid format and can be resolved via DNS. 'disable_email_validation' => false, + // disable_mentions_removal (Boolean) + // Disables the automatic removal of mentions in ActivityPub postings. + 'disable_mentions_removal' => false, + // disable_url_validation (Boolean) // Disables the DNS lookup of an URL. 'disable_url_validation' => false, diff --git a/src/Protocol/ActivityPub/Processor.php b/src/Protocol/ActivityPub/Processor.php index c3b41a1ae..446536278 100644 --- a/src/Protocol/ActivityPub/Processor.php +++ b/src/Protocol/ActivityPub/Processor.php @@ -689,6 +689,10 @@ class Processor */ private static function removeImplicitMentionsFromBody($body, array $implicit_mentions) { + if (Config::get('system', 'disable_mentions_removal')) { + return; + } + $kept_mentions = []; // Extract one prepended mention at a time from the body From ca7ceb6fe278d6ff8be09200187f93e25817e939 Mon Sep 17 00:00:00 2001 From: Michael Date: Wed, 13 Feb 2019 17:26:54 +0000 Subject: [PATCH 2/3] We should return something ;-) --- src/Protocol/ActivityPub/Processor.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Protocol/ActivityPub/Processor.php b/src/Protocol/ActivityPub/Processor.php index 446536278..f4befcd6f 100644 --- a/src/Protocol/ActivityPub/Processor.php +++ b/src/Protocol/ActivityPub/Processor.php @@ -690,7 +690,7 @@ class Processor private static function removeImplicitMentionsFromBody($body, array $implicit_mentions) { if (Config::get('system', 'disable_mentions_removal')) { - return; + return $body; } $kept_mentions = []; From 41445a412d2d14565bbb3cc275695535cd0a84ad Mon Sep 17 00:00:00 2001 From: Michael Date: Wed, 13 Feb 2019 22:36:55 +0000 Subject: [PATCH 3/3] Changed description --- config/defaults.config.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/defaults.config.php b/config/defaults.config.php index 8a9bc19b5..694f75c22 100644 --- a/config/defaults.config.php +++ b/config/defaults.config.php @@ -136,7 +136,7 @@ return [ 'disable_email_validation' => false, // disable_mentions_removal (Boolean) - // Disables the automatic removal of mentions in ActivityPub postings. + // Disables the automatic removal of implicit mentions in ActivityPub postings. 'disable_mentions_removal' => false, // disable_url_validation (Boolean)