Merge pull request from annando/config-mentions-removal

New configuration to disable the automatic mentions removal
This commit is contained in:
Hypolite Petovan 2019-02-13 18:06:28 -05:00 committed by GitHub
commit d101103b0b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions
config
src/Protocol/ActivityPub

View file

@ -135,6 +135,10 @@ return [
// Disables the check if a mail address is in a valid format and can be resolved via DNS. // Disables the check if a mail address is in a valid format and can be resolved via DNS.
'disable_email_validation' => false, 'disable_email_validation' => false,
// disable_mentions_removal (Boolean)
// Disables the automatic removal of implicit mentions in ActivityPub postings.
'disable_mentions_removal' => false,
// disable_url_validation (Boolean) // disable_url_validation (Boolean)
// Disables the DNS lookup of an URL. // Disables the DNS lookup of an URL.
'disable_url_validation' => false, 'disable_url_validation' => false,

View file

@ -689,6 +689,10 @@ class Processor
*/ */
private static function removeImplicitMentionsFromBody($body, array $implicit_mentions) private static function removeImplicitMentionsFromBody($body, array $implicit_mentions)
{ {
if (Config::get('system', 'disable_mentions_removal')) {
return $body;
}
$kept_mentions = []; $kept_mentions = [];
// Extract one prepended mention at a time from the body // Extract one prepended mention at a time from the body