Reports: Make it work

This commit is contained in:
veselcraft 2021-09-28 18:52:04 +03:00
parent b47781c6b4
commit 1b73cfd551
3 changed files with 5 additions and 13 deletions

View file

@ -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();
}
}

View file

@ -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");
}
}

View file

@ -12,7 +12,7 @@
<p><b>Комментарий: </b>{$report->getReason()}</p>
{include "../components/post/oldpost.xml", post => $report->getContentObject()}
<center>
<form action="/admin/reportAction{$report->getId()}">
<form action="/admin/reportAction{$report->getId()}" method="post">
<input type="hidden" name="hash" value="{$csrfToken}" />
<input type="submit" name="ban" value="Забанить пользователя" class="button">
<input type="submit" name="delete" value="Удалить контент" class="button">