From 1b73cfd551d2b282bc1b980fb288f3197a331b98 Mon Sep 17 00:00:00 2001 From: veselcraft Date: Tue, 28 Sep 2021 18:52:04 +0300 Subject: [PATCH] Reports: Make it work --- Web/Models/Entities/Report.php | 8 -------- Web/Presenters/ReportPresenter.php | 8 ++++---- Web/Presenters/templates/Report/View.xml | 2 +- 3 files changed, 5 insertions(+), 13 deletions(-) diff --git a/Web/Models/Entities/Report.php b/Web/Models/Entities/Report.php index 15c1e017..950721d5 100644 --- a/Web/Models/Entities/Report.php +++ b/Web/Models/Entities/Report.php @@ -81,14 +81,6 @@ class Report extends RowModel $this->getUser()->adminNotify("Ваш контент, который вы опубликовали " . $this->getContentObject()->getPublicationTime() . " был удалён модераторами инстанса. За повторные или серьёзные нарушения вас могут заблокировать."); $this->getContentObject()->delete(); $this->setDeleted(1); - $this->unwire(); - $this->save(); - } - - function setDeleted() - { - $this->setDeleted(1); - $this->unwire(); $this->save(); } } diff --git a/Web/Presenters/ReportPresenter.php b/Web/Presenters/ReportPresenter.php index 64ca900f..467d8e64 100644 --- a/Web/Presenters/ReportPresenter.php +++ b/Web/Presenters/ReportPresenter.php @@ -76,7 +76,7 @@ final class ReportPresenter extends OpenVKPresenter $this->assertPermission('openvk\Web\Models\Entities\TicketReply', 'write', 0); if($this->postParam("ban")) { - $report = $this->report->get($id); + $report = $this->reports->get($id); if(!$report) $this->notFound(); if($report->isDeleted()) $this->notFound(); if(is_null($this->user)) @@ -86,7 +86,7 @@ final class ReportPresenter extends OpenVKPresenter $report->deleteContent(); $this->flash("suc", "Смэрть...", "Пользователь успешно забанен."); }else if($this->postParam("delete")){ - $report = $this->report->get($id); + $report = $this->reports->get($id); if(!$report) $this->notFound(); if($report->isDeleted()) $this->notFound(); if(is_null($this->user)) @@ -95,7 +95,7 @@ final class ReportPresenter extends OpenVKPresenter $report->deleteContent(); $this->flash("suc", "Нехай живе!", "Контент удалён, а пользователю прилетело предупреждение."); }else if($this->postParam("ignore")){ - $report = $this->report->get($id); + $report = $this->reports->get($id); if(!$report) $this->notFound(); if($report->isDeleted()) $this->notFound(); if(is_null($this->user)) @@ -104,6 +104,6 @@ final class ReportPresenter extends OpenVKPresenter $report->setDeleted(); $this->flash("suc", "Нехай живе!", "Жалоба проигнорирована."); } - $this->redirect("/report/list"); + $this->redirect("/admin/reports"); } } diff --git a/Web/Presenters/templates/Report/View.xml b/Web/Presenters/templates/Report/View.xml index a89d8bef..2c802521 100644 --- a/Web/Presenters/templates/Report/View.xml +++ b/Web/Presenters/templates/Report/View.xml @@ -12,7 +12,7 @@

Комментарий: {$report->getReason()}

{include "../components/post/oldpost.xml", post => $report->getContentObject()}
-
+