Заблокировать / Переоткрыть

This commit is contained in:
n1rwana 2022-08-25 16:23:43 +03:00
parent 0009ec8af1
commit c5d6c86a9d
3 changed files with 33 additions and 9 deletions

View file

@ -50,7 +50,8 @@ class BugReport extends RowModel
tr("bug_tracker_status_closed"),
tr("bug_tracker_status_requires_adjustment"),
tr("bug_tracker_status_locked"),
tr("bug_tracker_status_rejected")
tr("bug_tracker_status_rejected"),
"Переоткрыт"
];
$status_id = $this->getRecord()->status;

View file

@ -85,6 +85,7 @@ final class BugtrackerPresenter extends OpenVKPresenter
function renderChangeStatus(int $report_id): void
{
$this->assertUserLoggedIn();
$this->assertNoCSRF();
$this->willExecuteWriteAction();
if ($this->user->identity->isBannedInBt())
@ -101,7 +102,8 @@ final class BugtrackerPresenter extends OpenVKPresenter
tr("bug_tracker_status_closed"),
tr("bug_tracker_status_requires_adjustment"),
tr("bug_tracker_status_locked"),
tr("bug_tracker_status_rejected")
tr("bug_tracker_status_rejected"),
"Переоткрыт"
];
$report = (new BugtrackerReports)->get($report_id);
@ -119,6 +121,7 @@ final class BugtrackerPresenter extends OpenVKPresenter
function renderChangePriority(int $report_id): void
{
$this->assertUserLoggedIn();
$this->assertNoCSRF();
$this->willExecuteWriteAction();
if ($this->user->identity->isBannedInBt())
@ -204,7 +207,7 @@ final class BugtrackerPresenter extends OpenVKPresenter
$product = $this->postParam("product");
$device = $this->postParam("device");
if (!$title || !$text || !$priority || !$product || !$device)
if (!$title || !$text || !$product || !$device || $priority === NULL)
$this->flashFail("err", tr("error"), tr("bug_tracker_fields_error"));
$id = DB::i()->getContext()->table("bugs")->insert([
@ -223,6 +226,7 @@ final class BugtrackerPresenter extends OpenVKPresenter
function renderCreateProduct(): void
{
$this->assertUserLoggedIn();
$this->assertNoCSRF();
$this->willExecuteWriteAction();
if ($this->user->identity->isBannedInBt())
@ -269,6 +273,7 @@ final class BugtrackerPresenter extends OpenVKPresenter
function renderManageAccess(int $product_id): void
{
$this->assertUserLoggedIn();
$this->assertNoCSRF();
$this->willExecuteWriteAction();
if ($this->user->identity->isBannedInBt())
@ -312,6 +317,7 @@ final class BugtrackerPresenter extends OpenVKPresenter
function renderManagePrivacy(int $product_id): void
{
$this->assertUserLoggedIn();
$this->assertNoCSRF();
$this->willExecuteWriteAction();
if ($this->user->identity->isBannedInBt())
@ -344,6 +350,7 @@ final class BugtrackerPresenter extends OpenVKPresenter
function renderManageStatus(int $product_id): void
{
$this->assertUserLoggedIn();
$this->assertNoCSRF();
$this->willExecuteWriteAction();
if ($this->user->identity->isBannedInBt())
@ -376,6 +383,7 @@ final class BugtrackerPresenter extends OpenVKPresenter
function renderKickTester(int $uid): void
{
$this->assertUserLoggedIn();
$this->assertNoCSRF();
$this->willExecuteWriteAction();
if ($this->user->identity->isBannedInBt())
@ -391,12 +399,16 @@ final class BugtrackerPresenter extends OpenVKPresenter
$user->setBlock_in_bt_reason($comment);
$user->save();
if ($this->postParam("ban_reports"))
DB::i()->getConnection()->query("UPDATE bugs SET status = 6 WHERE reporter = " . $uid);
$this->flashFail("succ", "Успех", $user->getCanonicalName() . " был исключён из программы OVK Testers.");
}
function renderUnbanTester(int $uid): void
{
$this->assertUserLoggedIn();
$this->assertNoCSRF();
$this->willExecuteWriteAction();
if ($this->user->identity->isBannedInBt())
@ -410,6 +422,9 @@ final class BugtrackerPresenter extends OpenVKPresenter
$user->setBlock_in_bt_reason(NULL);
$user->save();
if ($this->postParam("unban_reports"))
DB::i()->getConnection()->query("UPDATE bugs SET status = 8 WHERE reporter = " . $uid);
$this->flashFail("succ", "Успех", $user->getCanonicalName() . " был разблокирован в баг-трекере.");
}
}

View file

@ -458,23 +458,27 @@ function showBtStatusChangeDialog(report, currentBalance, hash) {
</tr>
<tr>
<td><input type="radio" name="status" value="3"></td>
<td><label for="status_3">Исправлен</label></td>
<td><label for="status_4">Исправлен</label></td>
</tr>
<tr>
<td><input type="radio" name="status" value="4"></td>
<td><label for="status_3">Закрыт</label></td>
<td><label for="status_5">Закрыт</label></td>
</tr>
<tr>
<td><input type="radio" name="status" value="5"></td>
<td><label for="status_3">Требует корректировки</label></td>
<td><label for="status_6">Требует корректировки</label></td>
</tr>
<tr>
<td><input type="radio" name="status" value="6"></td>
<td><label for="status_3">Заблокирован</label></td>
<td><label for="status_7">Заблокирован</label></td>
</tr>
<tr>
<td><input type="radio" name="status" value="7"></td>
<td><label for="status_3">Отклонён</label></td>
<td><label for="status_8">Отклонён</label></td>
</tr>
<tr>
<td><input type="radio" name="status" value="8"></td>
<td><label for="status_9">Переоткрыт</label></td>
</tr>
</tbody>
</table>
@ -664,6 +668,8 @@ function showBtKickUserDialog(user, hash) {
<br>
<h4>Комментарий модератора</h4>
<textarea name="comment" style="width: 100%;resize: vertical;"></textarea>
<input type="checkbox" name="ban_reports" id="ban_reports">
<label for="ban_reports">Заблокировать все его отчёты</label>
<input type="hidden" name="hash" value="${hash}" />
`, ["Продолжить", tr("cancel")], [
() => {
@ -674,10 +680,12 @@ function showBtKickUserDialog(user, hash) {
}
function showBtUnbanUserDialog(user, hash) {
MessageBox("Исключить из программы", `<form action="/bt_reporter${user[0]}/unban" method="post" id="unban_ovk_testers_dialog">
MessageBox("Вернуть в программу", `<form action="/bt_reporter${user[0]}/unban" method="post" id="unban_ovk_testers_dialog">
<div>Вы действительно хотите вернуть тестировщика <b>${user[1]}</b> в программу OVK Testers?</div>
<br>
<div>Он был исключён по причине: <b>${user[2]}</b></div>
<input type="checkbox" name="unban_reports" id="unban_reports">
<label for="ban_reports">Переоткрыть все его отчёты</label>
<input type="hidden" name="hash" value="${hash}" />
`, ["Вернуть", tr("cancel")], [
() => {