mirror of
https://github.com/openvk/openvk
synced 2024-11-11 01:19:53 +03:00
Support: Add closing all tickets when banned
slowly getting back on "business"... Resolves #584
This commit is contained in:
parent
e2054d72a4
commit
84635a22ba
2 changed files with 8 additions and 1 deletions
|
@ -6,6 +6,7 @@ use openvk\Web\Models\Entities\TicketComment;
|
|||
use openvk\Web\Models\Repositories\TicketComments;
|
||||
use openvk\Web\Util\Telegram;
|
||||
use Chandler\Session\Session;
|
||||
use Chandler\Database\DatabaseConnection;
|
||||
use Parsedown;
|
||||
|
||||
final class SupportPresenter extends OpenVKPresenter
|
||||
|
@ -322,6 +323,10 @@ final class SupportPresenter extends OpenVKPresenter
|
|||
|
||||
$user->setBlock_In_Support_Reason($this->queryParam("reason"));
|
||||
$user->save();
|
||||
|
||||
if($this->queryParam("close_tickets"))
|
||||
DatabaseConnection::i()->getConnection()->query("UPDATE tickets SET type = 2 WHERE user_id = ".$id);
|
||||
|
||||
$this->returnJson([ "success" => true, "reason" => $this->queryParam("reason") ]);
|
||||
}
|
||||
|
||||
|
|
|
@ -580,12 +580,14 @@
|
|||
function toggleBanInSupport() {
|
||||
uBanMsgTxt = "Вы собираетесь заблокировать в поддержке пользователя " + {$user->getCanonicalName()} + ".";
|
||||
uBanMsgTxt += "<br/><br/><b>Причина бана</b>: <input type='text' id='uBanMsgInput' placeholder='придумайте что-нибудь крутое' />";
|
||||
uBanMsgTxt += "<br/><br/><input type='checkbox' id='uBanClsTicketsInput' /><label for='uBanClsTicketsInput'>Закрыть все обращения пользователя</label>";
|
||||
|
||||
MessageBox("Заблокировать в поддержке " + {$user->getFirstName()}, uBanMsgTxt, ["Подтвердить", "Отмена"], [
|
||||
(function() {
|
||||
res = document.querySelector("#uBanMsgInput").value;
|
||||
cls = document.querySelector("#uBanClsTicketsInput").value;
|
||||
xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", "/admin/support/ban/" + {$user->getId()} + "?reason=" + res + "&hash=" + {rawurlencode($csrfToken)}, true);
|
||||
xhr.open("GET", "/admin/support/ban/" + {$user->getId()} + "?reason=" + res + "&close_tickets=" + cls + "&hash=" + {rawurlencode($csrfToken)}, true);
|
||||
xhr.onload = (function() {
|
||||
if(xhr.responseText.indexOf("success") === -1)
|
||||
MessageBox("Ошибка", "Не удалось заблокировать пользователя в поддержке...", ["OK"], [Function.noop]);
|
||||
|
|
Loading…
Reference in a new issue