Remove data when suspending Mastodon account, only if remote
* Remove classes/PgDatabase restriction to api/vX/database
This commit is contained in:
parent
c1b72a6b0a
commit
f9b9b4be40
|
@ -9,9 +9,19 @@ $_ = function() {
|
|||
if (isset($_POST['explain']))
|
||||
$explain = trim($_POST['explain']);
|
||||
|
||||
$is_remote_account = false;
|
||||
$pg = new PgDatabase();
|
||||
if ($pg->is_ok()) {
|
||||
$result = $pg->fetch('SELECT domain FROM accounts WHERE id = '.$id);
|
||||
$is_remote_account = isset($result['domain']) && $result['domain'] !== null;
|
||||
}
|
||||
|
||||
$output = instance_http_post('/api/v1/admin/accounts/'.$id.'/action',
|
||||
['type' => 'suspend', 'text' => $explain ]);
|
||||
#$output = instance_http_delete('/api/v1/admin/accounts/'.$id);
|
||||
if ($is_remote_account)
|
||||
instance_http_delete('/api/v1/admin/accounts/'.$id);
|
||||
|
||||
if (!isset($_SERVER['REQUEST_URI']))
|
||||
sleep(3);
|
||||
return apiresult($output);
|
||||
};
|
||||
|
|
|
@ -8,7 +8,6 @@ class PgDatabase {
|
|||
$url = trim($_SERVER['REQUEST_URI'], '/');
|
||||
$url = substr($url, 7); // api/vX/
|
||||
$ps = explode('/', $url);
|
||||
if ($ps[0] !== 'database') return;
|
||||
$software = $ps[1];
|
||||
}
|
||||
if ($software === null && isset($GLOBALS['ap_software']))
|
||||
|
|
Loading…
Reference in New Issue