mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2025-02-02 04:12:20 +00:00
Merge pull request #2843 from bookwyrm-social/user-reports-link
Show all (not just open) reports when linked from user admin
This commit is contained in:
commit
24d59315df
4 changed files with 12 additions and 5 deletions
|
@ -21,10 +21,10 @@
|
||||||
{% block panel %}
|
{% block panel %}
|
||||||
<div class="tabs">
|
<div class="tabs">
|
||||||
<ul>
|
<ul>
|
||||||
<li class="{% if not resolved %}is-active{% endif %}"{% if not resolved == 'open' %} aria-current="page"{% endif %}>
|
<li class="{% if not resolved %}is-active{% endif %}"{% if not resolved %} aria-current="page"{% endif %}>
|
||||||
<a href="{% url 'settings-reports' %}?resolved=false">{% trans "Open" %}</a>
|
<a href="{% url 'settings-reports' %}?resolved=false">{% trans "Open" %}</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="{% if resolved %}is-active{% endif %}"{% if resolved %} aria-current="page"{% endif %}>
|
<li class="{% if resolved and resolved != "all" %}is-active{% endif %}"{% if resolved and resolved != "all" %} aria-current="page"{% endif %}>
|
||||||
<a href="{% url 'settings-reports' %}?resolved=true">{% trans "Resolved" %}</a>
|
<a href="{% url 'settings-reports' %}?resolved=true">{% trans "Resolved" %}</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -61,7 +61,7 @@
|
||||||
<dd>
|
<dd>
|
||||||
{{ report_count|intcomma }}
|
{{ report_count|intcomma }}
|
||||||
{% if report_count > 0 %}
|
{% if report_count > 0 %}
|
||||||
<a href="{% url 'settings-reports' %}?username={{ user.username }}">
|
<a href="{% url 'settings-reports' %}?username={{ user.username }}&resolved=all">
|
||||||
{% trans "(View reports)" %}
|
{% trans "(View reports)" %}
|
||||||
</a>
|
</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -18,6 +18,7 @@ def validate_html(html):
|
||||||
for e in errors.split("\n")
|
for e in errors.split("\n")
|
||||||
if "&book" not in e
|
if "&book" not in e
|
||||||
and "&type" not in e
|
and "&type" not in e
|
||||||
|
and "&resolved" not in e
|
||||||
and "id and name attribute" not in e
|
and "id and name attribute" not in e
|
||||||
and "illegal characters found in URI" not in e
|
and "illegal characters found in URI" not in e
|
||||||
and "escaping malformed URI reference" not in e
|
and "escaping malformed URI reference" not in e
|
||||||
|
|
|
@ -29,14 +29,20 @@ class ReportsAdmin(View):
|
||||||
"""view current reports"""
|
"""view current reports"""
|
||||||
filters = {}
|
filters = {}
|
||||||
|
|
||||||
resolved = request.GET.get("resolved") == "true"
|
# we sometimes want to see all reports, regardless of resolution
|
||||||
|
if request.GET.get("resolved") == "all":
|
||||||
|
resolved = "all"
|
||||||
|
else:
|
||||||
|
resolved = request.GET.get("resolved") == "true"
|
||||||
|
|
||||||
server = request.GET.get("server")
|
server = request.GET.get("server")
|
||||||
if server:
|
if server:
|
||||||
filters["user__federated_server__server_name"] = server
|
filters["user__federated_server__server_name"] = server
|
||||||
username = request.GET.get("username")
|
username = request.GET.get("username")
|
||||||
if username:
|
if username:
|
||||||
filters["user__username__icontains"] = username
|
filters["user__username__icontains"] = username
|
||||||
filters["resolved"] = resolved
|
if resolved != "all":
|
||||||
|
filters["resolved"] = resolved
|
||||||
|
|
||||||
reports = models.Report.objects.filter(**filters)
|
reports = models.Report.objects.filter(**filters)
|
||||||
paginated = Paginator(reports, PAGE_LENGTH)
|
paginated = Paginator(reports, PAGE_LENGTH)
|
||||||
|
|
Loading…
Reference in a new issue