mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-10-31 22:19:00 +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 %}
|
||||
<div class="tabs">
|
||||
<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>
|
||||
</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>
|
||||
</li>
|
||||
</ul>
|
||||
|
|
|
@ -61,7 +61,7 @@
|
|||
<dd>
|
||||
{{ report_count|intcomma }}
|
||||
{% 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)" %}
|
||||
</a>
|
||||
{% endif %}
|
||||
|
|
|
@ -18,6 +18,7 @@ def validate_html(html):
|
|||
for e in errors.split("\n")
|
||||
if "&book" not in e
|
||||
and "&type" not in e
|
||||
and "&resolved" not in e
|
||||
and "id and name attribute" not in e
|
||||
and "illegal characters found in URI" not in e
|
||||
and "escaping malformed URI reference" not in e
|
||||
|
|
|
@ -29,14 +29,20 @@ class ReportsAdmin(View):
|
|||
"""view current reports"""
|
||||
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")
|
||||
if server:
|
||||
filters["user__federated_server__server_name"] = server
|
||||
username = request.GET.get("username")
|
||||
if username:
|
||||
filters["user__username__icontains"] = username
|
||||
filters["resolved"] = resolved
|
||||
if resolved != "all":
|
||||
filters["resolved"] = resolved
|
||||
|
||||
reports = models.Report.objects.filter(**filters)
|
||||
paginated = Paginator(reports, PAGE_LENGTH)
|
||||
|
|
Loading…
Reference in a new issue