From 08859fadd82e46ba3f45bdb698c33d24494eb513 Mon Sep 17 00:00:00 2001
From: n1rwana <93197434+n1rwana@users.noreply.github.com>
Date: Sat, 20 Aug 2022 21:45:28 +0300
Subject: [PATCH] =?UTF-8?q?=D0=9B=D0=B0=D0=B2=D0=BA=D0=B0=20=D0=9E=D0=92?=
=?UTF-8?q?=D0=9A=20=D0=A2=D0=B5=D1=81=D1=82=D0=B5=D1=80=D1=81:=20=D0=9D?=
=?UTF-8?q?=D0=B0=D1=87=D0=B0=D0=BB=D0=BE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Теперь модератор может начислять голоса при изменении статуса/приоритета отчета
---
Web/Presenters/BugtrackerPresenter.php | 10 ++++++++++
Web/static/js/openvk.cls.js | 12 ++++++++++++
2 files changed, 22 insertions(+)
diff --git a/Web/Presenters/BugtrackerPresenter.php b/Web/Presenters/BugtrackerPresenter.php
index 262f8041..2350629e 100644
--- a/Web/Presenters/BugtrackerPresenter.php
+++ b/Web/Presenters/BugtrackerPresenter.php
@@ -70,10 +70,15 @@ final class BugtrackerPresenter extends OpenVKPresenter
$status = $this->postParam("status");
$comment = $this->postParam("text");
+ $points = $this->postParam("points-count");
$list = ["Открыт", "На рассмотрении", "В работе", "Исправлен", "Закрыт", "Требует корректировки", "Заблокирован", "Отклонён"];
$report = (new BugtrackerReports)->get($report_id);
$report->setStatus($status);
+
+ if ($points)
+ DB::i()->getContext()->query("UPDATE `profiles` SET `coins` = `coins` + " . $points . " WHERE `id` = " . $report->getReporter()->getId());
+
$report->save();
$this->createComment($report, $comment, "Новый статус отчёта — $list[$status]", TRUE);
@@ -87,10 +92,15 @@ final class BugtrackerPresenter extends OpenVKPresenter
$priority = $this->postParam("priority");
$comment = $this->postParam("text");
+ $points = $this->postParam("points-count");
$list = ["Пожелание", "Низкий", "Средний", "Высокий", "Критический", "Уязвимость"];
$report = (new BugtrackerReports)->get($report_id);
$report->setPriority($priority);
+
+ if ($points)
+ DB::i()->getContext()->query("UPDATE `profiles` SET `coins` = `coins` + " . $points . " WHERE `id` = " . $report->getReporter()->getId());
+
$report->save();
$this->createComment($report, $comment, "Новый приоритет отчёта — $list[$priority]", TRUE);
diff --git a/Web/static/js/openvk.cls.js b/Web/static/js/openvk.cls.js
index 6e484cd6..21591354 100755
--- a/Web/static/js/openvk.cls.js
+++ b/Web/static/js/openvk.cls.js
@@ -481,6 +481,12 @@ function showBtStatusChangeDialog(report, hash) {