Removed the ability to remove points

This commit is contained in:
n1rwana 2022-08-29 03:35:23 +03:00
parent c5d6c86a9d
commit 2317c79143
2 changed files with 10 additions and 8 deletions

View file

@ -109,8 +109,10 @@ final class BugtrackerPresenter extends OpenVKPresenter
$report = (new BugtrackerReports)->get($report_id); $report = (new BugtrackerReports)->get($report_id);
$report->setStatus($status); $report->setStatus($status);
if ($points) if ($points >= 0)
DB::i()->getContext()->query("UPDATE `profiles` SET `coins` = `coins` + " . $points . " WHERE `id` = " . $report->getReporter()->getId()); DB::i()->getContext()->query("UPDATE `profiles` SET `coins` = `coins` + " . $points . " WHERE `id` = " . $report->getReporter()->getId());
else
$this->flashFail("err", tr("error"), "Число голосов должно быть больше или равно 0.");
$report->save(); $report->save();
@ -142,8 +144,10 @@ final class BugtrackerPresenter extends OpenVKPresenter
$report = (new BugtrackerReports)->get($report_id); $report = (new BugtrackerReports)->get($report_id);
$report->setPriority($priority); $report->setPriority($priority);
if ($points) if ($points >= 0)
DB::i()->getContext()->query("UPDATE `profiles` SET `coins` = `coins` + " . $points . " WHERE `id` = " . $report->getReporter()->getId()); DB::i()->getContext()->query("UPDATE `profiles` SET `coins` = `coins` + " . $points . " WHERE `id` = " . $report->getReporter()->getId());
else
$this->flashFail("err", tr("error"), "Число голосов должно быть больше или равно 0.");
$report->save(); $report->save();

View file

@ -490,13 +490,12 @@ function showBtStatusChangeDialog(report, currentBalance, hash) {
<br> <br>
<div style="display: inline;"> <div style="display: inline;">
Вы можете начислить &nbsp; Вы можете начислить &nbsp;
<input style="width: 45px; height: 9px;" type="number" name="points-count" value="0"> <input style="width: 45px; height: 9px;" type="number" name="points-count" value="0" min="0">
&nbsp;голосов &nbsp;голосов
<span class="nobold">(отрицательные значения поддерживаются)</span>
</div> </div>
<input type="hidden" name="hash" value="${hash}" /> <input type="hidden" name="hash" value="${hash}" />
</form> </form>
`, ["Сохранить", tr("cancel")], [ `, ["Сохранить", "Отмена"], [
() => { () => {
$("#status_change_dialog").submit(); $("#status_change_dialog").submit();
}, },
@ -542,13 +541,12 @@ function showBtPriorityChangeDialog(report, currentBalance, hash) {
<br> <br>
<div style="display: inline;"> <div style="display: inline;">
Вы можете начислить &nbsp; Вы можете начислить &nbsp;
<input style="width: 45px; height: 9px;" type="number" name="points-count" value="0"> <input style="width: 45px; height: 9px;" type="number" name="points-count" value="0" min="0">
&nbsp;голосов &nbsp;голосов
<span class="nobold">(отрицательные значения поддерживаются)</span>
</div> </div>
<input type="hidden" name="hash" value="${hash}" /> <input type="hidden" name="hash" value="${hash}" />
</form> </form>
`, ["Сохранить", tr("cancel")], [ `, ["Сохранить", "Отмена"], [
() => { () => {
$("#priority_change_dialog").submit(); $("#priority_change_dialog").submit();
}, },