From: Michael Tremer Date: Tue, 10 Mar 2026 15:24:44 +0000 (+0000) Subject: reports: Automatically close any reports from trusted reporters X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8ab780c20560866eb610619e529cae9bbce1dca8;p=dbl.git reports: Automatically close any reports from trusted reporters Signed-off-by: Michael Tremer --- diff --git a/src/dbl/reports.py b/src/dbl/reports.py index e37b676..685ce5a 100644 --- a/src/dbl/reports.py +++ b/src/dbl/reports.py @@ -154,6 +154,18 @@ class Reports(object): if notify: await report._send_opening_notification() + # Fetch the reporter + reporter = self.backend.users.get_by_uid(report.reported_by) + + # Has this report been filed by a trusted reporter? + if reporter and reporter.is_trusted(): + # Automatically close any reports from trusted reporters + await report.close( + closed_by = reporter, + accept = True, + notify = notify, + ) + return report async def notify(self): @@ -347,7 +359,7 @@ class Report(sqlmodel.SQLModel, database.BackendMixin, table=True): # Close! - async def close(self, closed_by=None, accept=True, update_stats=True): + async def close(self, closed_by=None, accept=True, notify=True, update_stats=True): """ Called when a moderator has made a decision """ @@ -371,7 +383,8 @@ class Report(sqlmodel.SQLModel, database.BackendMixin, table=True): self.accepted = accept # Send a message to the reporter? - await self._send_closing_notification() + if notify: + await self._send_closing_notification() # We are done if the report has not been accepted if not self.accepted: