diff --git a/Web/Models/Entities/User.php b/Web/Models/Entities/User.php
index 64b689e4..c4888d75 100644
--- a/Web/Models/Entities/User.php
+++ b/Web/Models/Entities/User.php
@@ -214,6 +214,11 @@ class User extends RowModel
{
return $this->getRecord()->block_reason;
}
+
+ function getBanInSupportReason(): ?string
+ {
+ return $this->getRecord()->block_in_support_reason;
+ }
function getType(): int
{
@@ -673,6 +678,11 @@ class User extends RowModel
{
return !is_null($this->getBanReason());
}
+
+ function isBannedInSupport(): bool
+ {
+ return !is_null($this->getBanInSupportReason());
+ }
function isOnline(): bool
{
diff --git a/Web/Presenters/SupportPresenter.php b/Web/Presenters/SupportPresenter.php
index a96ac465..9c2bcc8e 100644
--- a/Web/Presenters/SupportPresenter.php
+++ b/Web/Presenters/SupportPresenter.php
@@ -1,7 +1,7 @@
template->tickets = $this->tickets->getTicketsByUserId($this->user->id, $this->template->page);
}
+ if($this->template->mode === "new")
+ $this->template->banReason = $this->user->identity->getBanInSupportReason();
+
if($_SERVER["REQUEST_METHOD"] === "POST") {
+ if($this->user->identity->isBannedInSupport())
+ $this->flashFail("err", tr("not_enough_permissions"), tr("not_enough_permissions_comment"));
+
if(!empty($this->postParam("name")) && !empty($this->postParam("text"))) {
$this->willExecuteWriteAction();
@@ -268,4 +274,32 @@ final class SupportPresenter extends OpenVKPresenter
exit(header("HTTP/1.1 200 OK"));
}
-}
\ No newline at end of file
+
+ function renderQuickBanInSupport(int $id): void
+ {
+ $this->assertPermission("openvk\Web\Models\Entities\TicketReply", "write", 0);
+ $this->assertNoCSRF();
+
+ $user = (new Users)->get($id);
+ if(!$user)
+ exit(json_encode([ "error" => "User does not exist" ]));
+
+ $user->setBlock_In_Support_Reason($this->queryParam("reason"));
+ $user->save();
+ $this->returnJson([ "success" => true, "reason" => $this->queryParam("reason") ]);
+ }
+
+ function renderQuickUnbanInSupport(int $id): void
+ {
+ $this->assertPermission("openvk\Web\Models\Entities\TicketReply", "write", 0);
+ $this->assertNoCSRF();
+
+ $user = (new Users)->get($id);
+ if(!$user)
+ exit(json_encode([ "error" => "User does not exist" ]));
+
+ $user->setBlock_In_Support_Reason(null);
+ $user->save();
+ $this->returnJson([ "success" => true ]);
+ }
+}
diff --git a/Web/Presenters/templates/Support/Index.xml b/Web/Presenters/templates/Support/Index.xml
index 8f0f8737..133cf073 100644
--- a/Web/Presenters/templates/Support/Index.xml
+++ b/Web/Presenters/templates/Support/Index.xml
@@ -26,16 +26,26 @@
{if $isNew}
-
+ {tr("banned_in_support_1", htmlentities($thisUser->getCanonicalName()))|noescape}
+ {tr("banned_in_support_2", htmlentities($banReason))|noescape}
+