diff --git a/Web/Presenters/AdminPresenter.php b/Web/Presenters/AdminPresenter.php
index 9c356d55..39845ae4 100644
--- a/Web/Presenters/AdminPresenter.php
+++ b/Web/Presenters/AdminPresenter.php
@@ -346,7 +346,20 @@ final class AdminPresenter extends OpenVKPresenter
exit(json_encode([ "error" => "User does not exist" ]));
$user->ban($this->queryParam("reason"));
- exit(json_encode([ "reason" => $this->queryParam("reason") ]));
+ exit(json_encode([ "success" => true, "reason" => $this->queryParam("reason") ]));
+ }
+
+ function renderQuickUnban(int $id): void
+ {
+ $this->assertNoCSRF();
+
+ $user = $this->users->get($id);
+ if(!$user)
+ exit(json_encode([ "error" => "User does not exist" ]));
+
+ $user->setBlock_Reason(null);
+ $user->save();
+ exit(json_encode([ "success" => true ]));
}
function renderQuickWarn(int $id): void
diff --git a/Web/Presenters/templates/User/View.xml b/Web/Presenters/templates/User/View.xml
index c9457cba..7af04225 100644
--- a/Web/Presenters/templates/User/View.xml
+++ b/Web/Presenters/templates/User/View.xml
@@ -522,7 +522,7 @@
xhr = new XMLHttpRequest();
xhr.open("GET", "/admin/ban/" + {$user->getId()} + "?reason=" + res + "&hash=" + {rawurlencode($csrfToken)}, true);
xhr.onload = (function() {
- if(xhr.responseText.indexOf("reason") === -1)
+ if(xhr.responseText.indexOf("success") === -1)
MessageBox("Ошибка", "Не удалось забанить пользователя...", ["OK"], [Function.noop]);
else
MessageBox("Операция успешна", "Пользователь заблокирован", ["OK"], [Function.noop]);
diff --git a/Web/Presenters/templates/User/banned.xml b/Web/Presenters/templates/User/banned.xml
index a9cfed3c..f1e6f8c1 100644
--- a/Web/Presenters/templates/User/banned.xml
+++ b/Web/Presenters/templates/User/banned.xml
@@ -4,4 +4,29 @@
{tr("user_banned", htmlentities($user->getFirstName()))|noescape}
{_"user_banned_comment"} {$user->getBanReason()}.