# Increment the counter of the list
report.list.pending_reports += 1
+ # Send a notification to the reporter
+ report._send_opening_notification()
+
return report
def notify(self):
"""
Called when a moderator has made a decision
"""
+ # Prevent a report from being closed again
+ if self.closed_by:
+ raise RuntimeError("Report %s has already been closed" % self)
+
# Mark this report as closed
self.closed_at = sqlmodel.func.current_timestamp()
self.closed_by = closed_by
# Notified At
notified_at: datetime.datetime | None = None
+ def _send_opening_notification(self):
+ """
+ Sends a notification to the reporter when this report is opened.
+ """
+ # Fetch the reporter
+ reporter = self.backend.users.get_by_uid(self.reported_by)
+
+ # Do nothing if we could not find the reporter
+ if not reporter:
+ return
+
+ # Compose the body
+ lines = (
+ _("Hello,"),
+ "",
+ _("Thank you for submitting a report to the IPFire DNSBL service."),
+ "",
+ _("We have received your report regarding %s and wanted to confirm that it's now in our moderation queue.") % self.name,
+ "",
+ _("Our moderation team will carefully review your submission and you'll receive an update via email"
+ " once a decision has been made. Please note that review times may vary depending on the volume of reports we receive."),
+ "",
+ _("We appreciate your contribution to keeping the internet safer."
+ " Reports like yours are essential to maintaining the effectiveness of our service."),
+ "",
+ _("Best regards,"),
+ "-%s" % _("DNSBL Moderation Team"),
+ )
+
+ # Send the email
+ reporter.sendmail("\n".join(lines), headers={
+ "Subject" : _("Your DNSBL Report Has Been Received"),
+ })
+
def _send_closing_notification(self):
"""
Sends a notification to the reporter when this report gets closed.