Users: Do not delete subscriptions when banned for flood requests

It wasn't cool
This commit is contained in:
Maxim Leshchenko 2021-12-25 22:32:15 +02:00
parent a3167ab828
commit 0a6ce0ffc0
No known key found for this signature in database
GPG key ID: BB9C44A8733FBEEE
2 changed files with 12 additions and 10 deletions

View file

@ -698,8 +698,9 @@ class User extends RowModel
]);
}
function ban(string $reason): void
function ban(string $reason, bool $deleteSubscriptions = true): void
{
if($deleteSubscriptions) {
$subs = DatabaseConnection::i()->getContext()->table("subscriptions");
$subs = $subs->where(
"follower = ? OR (target = ? AND model = ?)",
@ -708,6 +709,7 @@ class User extends RowModel
get_class($this),
);
$subs->delete();
}
$this->setBlock_Reason($reason);
$this->save();

View file

@ -139,7 +139,7 @@ abstract class OpenVKPresenter extends SimplePresenter
if(!($res === IP::RL_RESET || $res === IP::RL_CANEXEC)) {
if($res === IP::RL_BANNED && OPENVK_ROOT_CONF["openvk"]["preferences"]["security"]["rateLimits"]["autoban"]) {
$this->user->identity->ban("Account has possibly been stolen");
$this->user->identity->ban("Account has possibly been stolen", false);
exit("Хакеры? Интересно...");
}