diff --git a/Web/Models/Entities/Report.php b/Web/Models/Entities/Report.php index 1d345fd40..ae1d9a276 100644 --- a/Web/Models/Entities/Report.php +++ b/Web/Models/Entities/Report.php @@ -90,9 +90,15 @@ public function getContentObject() } } - public function getAuthor(): RowModel + public function getAuthor(?bool $realPostAuthor = false): RowModel { - return $this->getContentObject()->getOwner(); + if ($this->getContentType() == "user") + return $this->getContentObject(); + + if (!in_array($this->getContentType(), ["post", "comment", "note", "topic"])) + return $this->getContentObject()->getOwner(); + + return $this->getContentObject()->getOwner(!$realPostAuthor, $realPostAuthor); } public function getReportAuthor(): User @@ -103,7 +109,7 @@ public function getReportAuthor(): User public function banUser($initiator) { $reason = $this->getContentType() !== "user" ? ("**content-" . $this->getContentType() . "-" . $this->getContentId() . "**") : ("Подозрительная активность"); - $this->getAuthor()->ban($reason, false, time() + $this->getAuthor()->getNewBanTime(), $initiator); + $this->getAuthor()->ban($reason, false, time() + $this->getAuthor(true)->getNewBanTime(), $initiator); } public function deleteContent() diff --git a/Web/Presenters/ReportPresenter.php b/Web/Presenters/ReportPresenter.php index 19254ab08..3347374eb 100644 --- a/Web/Presenters/ReportPresenter.php +++ b/Web/Presenters/ReportPresenter.php @@ -134,6 +134,25 @@ public function renderAction(int $id): void if (!$report || $report->isDeleted()) { $this->notFound(); } + + if ($report->getContentType() === "user" && $this->postParam("excludeUserFromGlobalFeed")) { + $reportedUser = $report->getContentObject(); + $reportedUser->setHide_Global_Feed(1); + $reportedUser->save(); + } + + if ($report->getContentType() !== "user" && $this->postParam("excludeAuthorFromGlobalFeed")) { + $reportedContentAuthor = $report->getAuthor(true); + $reportedContentAuthor->setHide_Global_Feed(1); + $reportedContentAuthor->save(); + } + + if (($report->getContentType() === "group" || $report->getAuthor()->getId() != $report->getAuthor(true)->getId()) && $this->postParam("excludeGroupFromGlobalFeed")) { + $reportedGroup = $report->getContentType() === "group" ? $report->getContentObject() : $report->getAuthor(); + $reportedGroup->setHide_From_Global_Feed(1); + $reportedGroup->setEnforce_Hiding_From_Global_Feed(1); + $reportedGroup->save(); + } if ($this->postParam("ban")) { $report->deleteContent(); diff --git a/Web/Presenters/templates/Report/View.xml b/Web/Presenters/templates/Report/View.xml index 6731ee534..bcf378f34 100644 --- a/Web/Presenters/templates/Report/View.xml +++ b/Web/Presenters/templates/Report/View.xml @@ -17,8 +17,19 @@ {_comment}: {$report->getReason()}

{include "ViewContent.xml", type => $report->getContentType(), object => $report->getContentObject()} -
+
+ {_report_force_exclude_user_from_global_feed|noescape} +
+
+ + {_report_force_exclude_author_from_global_feed|noescape} ({$report->getAuthor(true)->getCanonicalName()}) +
+
+ + {_report_force_exclude_group_from_global_feed|noescape} + {if $report->getContentType() != 'group'}({$report->getAuthor()->getCanonicalName()}){/if} +
diff --git a/locales/en.strings b/locales/en.strings index c21c05525..8795bf5f8 100644 --- a/locales/en.strings +++ b/locales/en.strings @@ -2332,6 +2332,11 @@ "nospam_prevention" = "This action will affect a lot of data. Are you sure you want to apply?"; +"report_force_exclude_author_from_global_feed" = "Exclude content author from global feed"; +"report_force_exclude_user_from_global_feed" = "Exclude user from global feed"; +"report_force_exclude_group_from_global_feed" = "Exclude group from global feed"; + + /* RSS */ "post_deact_in_general" = "Page deletion"; diff --git a/locales/ru.strings b/locales/ru.strings index e531072fd..ab5fac016 100644 --- a/locales/ru.strings +++ b/locales/ru.strings @@ -2227,6 +2227,10 @@ "nospam_prevention" = "Данное действие затронет множество данных. Вы действительно хотите применить?"; +"report_force_exclude_author_from_global_feed" = "Исключить автора контента из глобальной ленты"; +"report_force_exclude_user_from_global_feed" = "Исключить пользователя из глобальной ленты"; +"report_force_exclude_group_from_global_feed" = "Исключить сообщество из глобальной ленты"; + /* RSS */ "post_deact_in_general" = "Удаление страницы";