From e161a25e0a1fb1a27418da285b20d944d0f06d6d Mon Sep 17 00:00:00 2001 From: Ilya Prokopenko Date: Sun, 10 Apr 2022 13:19:54 +0300 Subject: [PATCH] Don't show error 500 when accessing a blocked user --- Web/Presenters/templates/User/banned.xml | 134 ++++++++++++----------- 1 file changed, 69 insertions(+), 65 deletions(-) diff --git a/Web/Presenters/templates/User/banned.xml b/Web/Presenters/templates/User/banned.xml index f0e7e661..ec08e473 100644 --- a/Web/Presenters/templates/User/banned.xml +++ b/Web/Presenters/templates/User/banned.xml @@ -4,82 +4,86 @@ {tr("user_banned", htmlentities($user->getFirstName()))|noescape}
{_"user_banned_comment"} {$user->getBanReason()}.

-

-
- {_unban_user_action} - - {if $user->isBannedInSupport()} - {_unban_in_support_user_action} - {else} - {_ban_in_support_user_action} - {/if} - -

+ {if isset($thisUser)} +

+
+ {_unban_user_action} + + {if $user->isBannedInSupport()} + {_unban_in_support_user_action} + {else} + {_ban_in_support_user_action} + {/if} + +

+ {/if} - - - - MessageBox("Заблокировать в поддержке " + {$user->getFirstName()}, uBanMsgTxt, ["Подтвердить", "Отмена"], [ - (function() { - res = document.querySelector("#uBanMsgInput").value; - xhr = new XMLHttpRequest(); - xhr.open("GET", "/admin/support/ban/" + {$user->getId()} + "?reason=" + res + "&hash=" + {rawurlencode($csrfToken)}, true); - xhr.onload = (function() { - if(xhr.responseText.indexOf("success") === -1) - MessageBox("Ошибка", "Не удалось заблокировать пользователя в поддержке...", ["OK"], [Function.noop]); - else - MessageBox("Операция успешна", "Пользователь заблокирован в поддержке", ["OK"], [Function.noop]); - }); - xhr.send(null); - }), - Function.noop - ]); - } - {/if} - + +{/if}