Merge pull request #10882 from MrPetovan/task/10865-contact-purge

Add new purge contact content option to admin contact blocklist
This commit is contained in:
Philipp 2021-10-17 23:44:28 +02:00 committed by GitHub
commit 5d0b7fd87b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 133 additions and 83 deletions

View file

@ -823,7 +823,7 @@ class Contact
self::update(['archive' => true, 'network' => Protocol::PHANTOM, 'deleted' => true], ['id' => $id]);
// Delete it in the background
Worker::add(PRIORITY_MEDIUM, 'RemoveContact', $id);
Worker::add(PRIORITY_MEDIUM, 'Contact\Remove', $id);
}
/**
@ -2562,48 +2562,6 @@ class Contact
return $result;
}
/**
* Updated contact's SSL policy
*
* @param array $contact Contact array
* @param string $new_policy New policy, valid: self,full
*
* @return array Contact array with updated values
* @throws \Exception
*/
public static function updateSslPolicy(array $contact, $new_policy)
{
$ssl_changed = false;
if ((intval($new_policy) == BaseURL::SSL_POLICY_SELFSIGN || $new_policy === 'self') && strstr($contact['url'], 'https:')) {
$ssl_changed = true;
$contact['url'] = str_replace('https:', 'http:', $contact['url']);
$contact['request'] = str_replace('https:', 'http:', $contact['request']);
$contact['notify'] = str_replace('https:', 'http:', $contact['notify']);
$contact['poll'] = str_replace('https:', 'http:', $contact['poll']);
$contact['confirm'] = str_replace('https:', 'http:', $contact['confirm']);
$contact['poco'] = str_replace('https:', 'http:', $contact['poco']);
}
if ((intval($new_policy) == BaseURL::SSL_POLICY_FULL || $new_policy === 'full') && strstr($contact['url'], 'http:')) {
$ssl_changed = true;
$contact['url'] = str_replace('http:', 'https:', $contact['url']);
$contact['request'] = str_replace('http:', 'https:', $contact['request']);
$contact['notify'] = str_replace('http:', 'https:', $contact['notify']);
$contact['poll'] = str_replace('http:', 'https:', $contact['poll']);
$contact['confirm'] = str_replace('http:', 'https:', $contact['confirm']);
$contact['poco'] = str_replace('http:', 'https:', $contact['poco']);
}
if ($ssl_changed) {
$fields = ['url' => $contact['url'], 'request' => $contact['request'],
'notify' => $contact['notify'], 'poll' => $contact['poll'],
'confirm' => $contact['confirm'], 'poco' => $contact['poco']];
self::update($fields, ['id' => $contact['id']]);
}
return $contact;
}
/**
* Follow a contact
*