From: Michael Tremer Date: Sun, 8 Feb 2026 18:04:13 +0000 (+0000) Subject: dbl: Refactor the reports page X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4f62892ac7e8ff82d9935ac8e77c59b11d1de350;p=ipfire.org.git dbl: Refactor the reports page Signed-off-by: Michael Tremer --- diff --git a/src/backend/accounts.py b/src/backend/accounts.py index cc48f686..fb26612e 100644 --- a/src/backend/accounts.py +++ b/src/backend/accounts.py @@ -921,6 +921,9 @@ class Account(LDAPObject): def is_lwl(self): return self.is_member_of_group("lwl-staff") + def is_dbl_moderator(self): + return self.is_member_of_group("dbl-moderators") + def can_be_managed_by(self, account): """ Returns True if account is allowed to manage this account diff --git a/src/templates/dbl/reports/show.html b/src/templates/dbl/reports/show.html index 58452da0..ce1f77f9 100644 --- a/src/templates/dbl/reports/show.html +++ b/src/templates/dbl/reports/show.html @@ -11,87 +11,118 @@ {% end block %} {% block container %} -
+
- +
+ -
-
-
-

- {{ report.name }} -

+ {# Comment #} +
+ {% if report.comment %} +
+
+ {{ _("%s commented:") % (reporter or report.reported_by) }} +
-

- {{ _("Submitted %(when)s by %(who)s") % { - "when" : locale.format_date(report.reported_at), - "who" : report.reported_by, - } }} -

- - {# Comment #} - {% if report.comment %} -
{{ report.comment }}
- {% end %} + {% module Markdown(report.comment) %} +
+ {% else %} +
+ {{ _("%s did not leave a comment") % (reporter or report.reported_by) }} +
+ {% end %} +
+
+
{# Status #} {% if status %} -
- {{ _("Status") }} -
+ {% for l, s in sorted(status.items()) %} + + + {% if s.status == "ALLOWED" %} + + {% elif s.status == "BLOCKED" %} + + {% end %} + - + {% if s.status == "ALLOWED" %} + {{ _("%(name)s is currently allowed on %(list)s") % { + "name" : report.name, + "list" : l, + } }} + {% elif s.status == "BLOCKED" %} + {{ _("%(name)s is currently blocked on %(list)s") % { + "name" : report.name, + "list" : l, + } }} + {% end %} + + {% end %} {% end %} -
+ + + {% if current_user and current_user.is_dbl_moderator() %} +
+
+ {% raw xsrf_form_html() %} + + +
+
+ +
+
+ {% raw xsrf_form_html() %} + + +
+
+ {% end %}
diff --git a/src/web/dbl.py b/src/web/dbl.py index 9beec10c..ac16132a 100644 --- a/src/web/dbl.py +++ b/src/web/dbl.py @@ -129,13 +129,17 @@ class ReportHandler(base.AnalyticsMixin, BaseHandler): # Fetch the list list = await report.get_list() + # Fetch the reporter + reporter = self.backend.accounts.get_by_uid(report.reported_by) + # Fetch the domain status if report.is_closed(): status = None else: status = await self.backend.dbl.search(report.name) - self.render("dbl/reports/show.html", report=report, list=list, status=status) + self.render("dbl/reports/show.html", report=report, + list=list, reporter=reporter, status=status) class SearchHandler(base.AnalyticsMixin, BaseHandler):