From 7b985f3a41b2091a7c738e6cd0f531fc4d77fd6b Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Tue, 28 Sep 2021 12:22:41 -0700 Subject: [PATCH 01/24] Sorts admin templates into even more directories --- bookwyrm/templates/settings/{ => announcements}/announcement.html | 0 .../templates/settings/{ => announcements}/announcement_form.html | 0 .../templates/settings/{ => announcements}/announcements.html | 0 bookwyrm/templates/settings/{ => dashboard}/dashboard.html | 0 .../settings/{ => dashboard}/dashboard_status_chart.html | 0 .../templates/settings/{ => dashboard}/dashboard_user_chart.html | 0 .../templates/settings/{ => email_blocklist}/domain_form.html | 0 .../templates/settings/{ => email_blocklist}/email_blocklist.html | 0 bookwyrm/templates/settings/{ => federation}/edit_server.html | 0 .../templates/settings/{ => federation}/federated_server.html | 0 bookwyrm/templates/settings/{ => federation}/federation.html | 0 .../templates/settings/{ => federation}/server_blocklist.html | 0 .../templates/settings/{ => invites}/invite_request_filters.html | 0 .../templates/settings/{ => invites}/manage_invite_requests.html | 0 bookwyrm/templates/settings/{ => invites}/manage_invites.html | 0 bookwyrm/templates/settings/{ => invites}/status_filter.html | 0 .../templates/settings/{ => ip_blocklist}/ip_address_form.html | 0 bookwyrm/templates/settings/{ => ip_blocklist}/ip_blocklist.html | 0 bookwyrm/templates/settings/{ => ip_blocklist}/ip_tooltip.html | 0 19 files changed, 0 insertions(+), 0 deletions(-) rename bookwyrm/templates/settings/{ => announcements}/announcement.html (100%) rename bookwyrm/templates/settings/{ => announcements}/announcement_form.html (100%) rename bookwyrm/templates/settings/{ => announcements}/announcements.html (100%) rename bookwyrm/templates/settings/{ => dashboard}/dashboard.html (100%) rename bookwyrm/templates/settings/{ => dashboard}/dashboard_status_chart.html (100%) rename bookwyrm/templates/settings/{ => dashboard}/dashboard_user_chart.html (100%) rename bookwyrm/templates/settings/{ => email_blocklist}/domain_form.html (100%) rename bookwyrm/templates/settings/{ => email_blocklist}/email_blocklist.html (100%) rename bookwyrm/templates/settings/{ => federation}/edit_server.html (100%) rename bookwyrm/templates/settings/{ => federation}/federated_server.html (100%) rename bookwyrm/templates/settings/{ => federation}/federation.html (100%) rename bookwyrm/templates/settings/{ => federation}/server_blocklist.html (100%) rename bookwyrm/templates/settings/{ => invites}/invite_request_filters.html (100%) rename bookwyrm/templates/settings/{ => invites}/manage_invite_requests.html (100%) rename bookwyrm/templates/settings/{ => invites}/manage_invites.html (100%) rename bookwyrm/templates/settings/{ => invites}/status_filter.html (100%) rename bookwyrm/templates/settings/{ => ip_blocklist}/ip_address_form.html (100%) rename bookwyrm/templates/settings/{ => ip_blocklist}/ip_blocklist.html (100%) rename bookwyrm/templates/settings/{ => ip_blocklist}/ip_tooltip.html (100%) diff --git a/bookwyrm/templates/settings/announcement.html b/bookwyrm/templates/settings/announcements/announcement.html similarity index 100% rename from bookwyrm/templates/settings/announcement.html rename to bookwyrm/templates/settings/announcements/announcement.html diff --git a/bookwyrm/templates/settings/announcement_form.html b/bookwyrm/templates/settings/announcements/announcement_form.html similarity index 100% rename from bookwyrm/templates/settings/announcement_form.html rename to bookwyrm/templates/settings/announcements/announcement_form.html diff --git a/bookwyrm/templates/settings/announcements.html b/bookwyrm/templates/settings/announcements/announcements.html similarity index 100% rename from bookwyrm/templates/settings/announcements.html rename to bookwyrm/templates/settings/announcements/announcements.html diff --git a/bookwyrm/templates/settings/dashboard.html b/bookwyrm/templates/settings/dashboard/dashboard.html similarity index 100% rename from bookwyrm/templates/settings/dashboard.html rename to bookwyrm/templates/settings/dashboard/dashboard.html diff --git a/bookwyrm/templates/settings/dashboard_status_chart.html b/bookwyrm/templates/settings/dashboard/dashboard_status_chart.html similarity index 100% rename from bookwyrm/templates/settings/dashboard_status_chart.html rename to bookwyrm/templates/settings/dashboard/dashboard_status_chart.html diff --git a/bookwyrm/templates/settings/dashboard_user_chart.html b/bookwyrm/templates/settings/dashboard/dashboard_user_chart.html similarity index 100% rename from bookwyrm/templates/settings/dashboard_user_chart.html rename to bookwyrm/templates/settings/dashboard/dashboard_user_chart.html diff --git a/bookwyrm/templates/settings/domain_form.html b/bookwyrm/templates/settings/email_blocklist/domain_form.html similarity index 100% rename from bookwyrm/templates/settings/domain_form.html rename to bookwyrm/templates/settings/email_blocklist/domain_form.html diff --git a/bookwyrm/templates/settings/email_blocklist.html b/bookwyrm/templates/settings/email_blocklist/email_blocklist.html similarity index 100% rename from bookwyrm/templates/settings/email_blocklist.html rename to bookwyrm/templates/settings/email_blocklist/email_blocklist.html diff --git a/bookwyrm/templates/settings/edit_server.html b/bookwyrm/templates/settings/federation/edit_server.html similarity index 100% rename from bookwyrm/templates/settings/edit_server.html rename to bookwyrm/templates/settings/federation/edit_server.html diff --git a/bookwyrm/templates/settings/federated_server.html b/bookwyrm/templates/settings/federation/federated_server.html similarity index 100% rename from bookwyrm/templates/settings/federated_server.html rename to bookwyrm/templates/settings/federation/federated_server.html diff --git a/bookwyrm/templates/settings/federation.html b/bookwyrm/templates/settings/federation/federation.html similarity index 100% rename from bookwyrm/templates/settings/federation.html rename to bookwyrm/templates/settings/federation/federation.html diff --git a/bookwyrm/templates/settings/server_blocklist.html b/bookwyrm/templates/settings/federation/server_blocklist.html similarity index 100% rename from bookwyrm/templates/settings/server_blocklist.html rename to bookwyrm/templates/settings/federation/server_blocklist.html diff --git a/bookwyrm/templates/settings/invite_request_filters.html b/bookwyrm/templates/settings/invites/invite_request_filters.html similarity index 100% rename from bookwyrm/templates/settings/invite_request_filters.html rename to bookwyrm/templates/settings/invites/invite_request_filters.html diff --git a/bookwyrm/templates/settings/manage_invite_requests.html b/bookwyrm/templates/settings/invites/manage_invite_requests.html similarity index 100% rename from bookwyrm/templates/settings/manage_invite_requests.html rename to bookwyrm/templates/settings/invites/manage_invite_requests.html diff --git a/bookwyrm/templates/settings/manage_invites.html b/bookwyrm/templates/settings/invites/manage_invites.html similarity index 100% rename from bookwyrm/templates/settings/manage_invites.html rename to bookwyrm/templates/settings/invites/manage_invites.html diff --git a/bookwyrm/templates/settings/status_filter.html b/bookwyrm/templates/settings/invites/status_filter.html similarity index 100% rename from bookwyrm/templates/settings/status_filter.html rename to bookwyrm/templates/settings/invites/status_filter.html diff --git a/bookwyrm/templates/settings/ip_address_form.html b/bookwyrm/templates/settings/ip_blocklist/ip_address_form.html similarity index 100% rename from bookwyrm/templates/settings/ip_address_form.html rename to bookwyrm/templates/settings/ip_blocklist/ip_address_form.html diff --git a/bookwyrm/templates/settings/ip_blocklist.html b/bookwyrm/templates/settings/ip_blocklist/ip_blocklist.html similarity index 100% rename from bookwyrm/templates/settings/ip_blocklist.html rename to bookwyrm/templates/settings/ip_blocklist/ip_blocklist.html diff --git a/bookwyrm/templates/settings/ip_tooltip.html b/bookwyrm/templates/settings/ip_blocklist/ip_tooltip.html similarity index 100% rename from bookwyrm/templates/settings/ip_tooltip.html rename to bookwyrm/templates/settings/ip_blocklist/ip_tooltip.html From 1c262a1a64b8dd9c2e7a812a9fb2288b25919da0 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Tue, 28 Sep 2021 12:26:55 -0700 Subject: [PATCH 02/24] Updates internal references --- bookwyrm/templates/settings/announcements/announcement.html | 2 +- bookwyrm/templates/settings/announcements/announcements.html | 2 +- bookwyrm/templates/settings/dashboard/dashboard.html | 4 ++-- .../templates/settings/email_blocklist/email_blocklist.html | 2 +- .../templates/settings/invites/invite_request_filters.html | 2 +- .../templates/settings/invites/manage_invite_requests.html | 2 +- bookwyrm/templates/settings/ip_blocklist/ip_blocklist.html | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/bookwyrm/templates/settings/announcements/announcement.html b/bookwyrm/templates/settings/announcements/announcement.html index b3375bb50..37dba06fe 100644 --- a/bookwyrm/templates/settings/announcements/announcement.html +++ b/bookwyrm/templates/settings/announcements/announcement.html @@ -26,7 +26,7 @@ {% block panel %}
- {% include 'settings/announcement_form.html' with controls_text="edit_announcement" %} + {% include 'settings/announcements/announcement_form.html' with controls_text="edit_announcement" %}
diff --git a/bookwyrm/templates/settings/announcements/announcements.html b/bookwyrm/templates/settings/announcements/announcements.html index 2c57ae787..2c97b0531 100644 --- a/bookwyrm/templates/settings/announcements/announcements.html +++ b/bookwyrm/templates/settings/announcements/announcements.html @@ -11,7 +11,7 @@ {% block panel %}
- {% include 'settings/announcement_form.html' with controls_text="create_announcement" %} + {% include 'settings/announcements/announcement_form.html' with controls_text="create_announcement" %}
diff --git a/bookwyrm/templates/settings/dashboard/dashboard.html b/bookwyrm/templates/settings/dashboard/dashboard.html index 608d32c97..add28d452 100644 --- a/bookwyrm/templates/settings/dashboard/dashboard.html +++ b/bookwyrm/templates/settings/dashboard/dashboard.html @@ -115,6 +115,6 @@ {% block scripts %} -{% include 'settings/dashboard_user_chart.html' %} -{% include 'settings/dashboard_status_chart.html' %} +{% include 'settings/dashboard/dashboard_user_chart.html' %} +{% include 'settings/dashboard/dashboard_status_chart.html' %} {% endblock %} diff --git a/bookwyrm/templates/settings/email_blocklist/email_blocklist.html b/bookwyrm/templates/settings/email_blocklist/email_blocklist.html index ea63b954e..4f7bbf4ba 100644 --- a/bookwyrm/templates/settings/email_blocklist/email_blocklist.html +++ b/bookwyrm/templates/settings/email_blocklist/email_blocklist.html @@ -12,7 +12,7 @@ {% endblock %} {% block panel %} -{% include 'settings/domain_form.html' with controls_text="add_domain" class="block" %} +{% include 'settings/email_blocklist/domain_form.html' with controls_text="add_domain" class="block" %}

{% trans "When someone tries to register with an email from this domain, no account will be created. The registration process will appear to have worked." %} diff --git a/bookwyrm/templates/settings/invites/invite_request_filters.html b/bookwyrm/templates/settings/invites/invite_request_filters.html index c55cc069c..a29518d89 100644 --- a/bookwyrm/templates/settings/invites/invite_request_filters.html +++ b/bookwyrm/templates/settings/invites/invite_request_filters.html @@ -1,6 +1,6 @@ {% extends 'snippets/filters_panel/filters_panel.html' %} {% block filter_fields %} -{% include 'settings/status_filter.html' %} +{% include 'settings/invites/status_filter.html' %} {% endblock %} diff --git a/bookwyrm/templates/settings/invites/manage_invite_requests.html b/bookwyrm/templates/settings/invites/manage_invite_requests.html index e0cfd6469..10b9bb50f 100644 --- a/bookwyrm/templates/settings/invites/manage_invite_requests.html +++ b/bookwyrm/templates/settings/invites/manage_invite_requests.html @@ -26,7 +26,7 @@ {% endif %} ({{ count }}) - {% include 'settings/invite_request_filters.html' %} + {% include 'settings/invites/invite_request_filters.html' %} {% url 'settings-invite-requests' as url %} diff --git a/bookwyrm/templates/settings/ip_blocklist/ip_blocklist.html b/bookwyrm/templates/settings/ip_blocklist/ip_blocklist.html index c978c1265..56a78ac1f 100644 --- a/bookwyrm/templates/settings/ip_blocklist/ip_blocklist.html +++ b/bookwyrm/templates/settings/ip_blocklist/ip_blocklist.html @@ -12,7 +12,7 @@ {% endblock %} {% block panel %} -{% include 'settings/ip_address_form.html' with controls_text="add_address" class="block" %} +{% include 'settings/ip_blocklist/ip_address_form.html' with controls_text="add_address" class="block" %}

{% trans "Any traffic from this IP address will get a 404 response when trying to access any part of the application." %} From 9c9adfc6f00ab401d9813b38841be35c69e8a7b5 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Tue, 28 Sep 2021 12:39:52 -0700 Subject: [PATCH 03/24] Updates references to templates --- .../{edit_server.html => edit_instances.html} | 0 .../{federated_server.html => instance.html} | 0 ...er_blocklist.html => instance_blocklist.html} | 0 .../{federation.html => instance_list.html} | 0 bookwyrm/views/admin/announcements.py | 16 ++++++++++++---- bookwyrm/views/admin/dashboard.py | 2 +- bookwyrm/views/admin/email_blocklist.py | 12 +++++++++--- bookwyrm/views/admin/federation.py | 16 ++++++++++------ bookwyrm/views/admin/invite.py | 8 +++++--- bookwyrm/views/admin/ip_blocklist.py | 12 +++++++++--- 10 files changed, 46 insertions(+), 20 deletions(-) rename bookwyrm/templates/settings/federation/{edit_server.html => edit_instances.html} (100%) rename bookwyrm/templates/settings/federation/{federated_server.html => instance.html} (100%) rename bookwyrm/templates/settings/federation/{server_blocklist.html => instance_blocklist.html} (100%) rename bookwyrm/templates/settings/federation/{federation.html => instance_list.html} (100%) diff --git a/bookwyrm/templates/settings/federation/edit_server.html b/bookwyrm/templates/settings/federation/edit_instances.html similarity index 100% rename from bookwyrm/templates/settings/federation/edit_server.html rename to bookwyrm/templates/settings/federation/edit_instances.html diff --git a/bookwyrm/templates/settings/federation/federated_server.html b/bookwyrm/templates/settings/federation/instance.html similarity index 100% rename from bookwyrm/templates/settings/federation/federated_server.html rename to bookwyrm/templates/settings/federation/instance.html diff --git a/bookwyrm/templates/settings/federation/server_blocklist.html b/bookwyrm/templates/settings/federation/instance_blocklist.html similarity index 100% rename from bookwyrm/templates/settings/federation/server_blocklist.html rename to bookwyrm/templates/settings/federation/instance_blocklist.html diff --git a/bookwyrm/templates/settings/federation/federation.html b/bookwyrm/templates/settings/federation/instance_list.html similarity index 100% rename from bookwyrm/templates/settings/federation/federation.html rename to bookwyrm/templates/settings/federation/instance_list.html diff --git a/bookwyrm/views/admin/announcements.py b/bookwyrm/views/admin/announcements.py index e778b709a..92ec1766c 100644 --- a/bookwyrm/views/admin/announcements.py +++ b/bookwyrm/views/admin/announcements.py @@ -41,7 +41,9 @@ class Announcements(View): "form": forms.AnnouncementForm(), "sort": sort, } - return TemplateResponse(request, "settings/announcements.html", data) + return TemplateResponse( + request, "settings/announcements/announcements.html", data + ) def post(self, request): """edit the site settings""" @@ -56,7 +58,9 @@ class Announcements(View): ).get_page(request.GET.get("page")), "form": form, } - return TemplateResponse(request, "settings/announcements.html", data) + return TemplateResponse( + request, "settings/announcements/announcements.html", data + ) @method_decorator(login_required, name="dispatch") @@ -74,7 +78,9 @@ class Announcement(View): "announcement": announcement, "form": forms.AnnouncementForm(instance=announcement), } - return TemplateResponse(request, "settings/announcement.html", data) + return TemplateResponse( + request, "settings/announcements/announcement.html", data + ) def post(self, request, announcement_id): """edit announcement""" @@ -87,7 +93,9 @@ class Announcement(View): "announcement": announcement, "form": form, } - return TemplateResponse(request, "settings/announcement.html", data) + return TemplateResponse( + request, "settings/announcements/announcement.html", data + ) @login_required diff --git a/bookwyrm/views/admin/dashboard.py b/bookwyrm/views/admin/dashboard.py index 161dc6da1..e02b9143e 100644 --- a/bookwyrm/views/admin/dashboard.py +++ b/bookwyrm/views/admin/dashboard.py @@ -85,4 +85,4 @@ class Dashboard(View): "user_stats": user_stats, "status_stats": status_stats, } - return TemplateResponse(request, "settings/dashboard.html", data) + return TemplateResponse(request, "settings/dashboard/dashboard.html", data) diff --git a/bookwyrm/views/admin/email_blocklist.py b/bookwyrm/views/admin/email_blocklist.py index cd3d83fdb..eecad4ffb 100644 --- a/bookwyrm/views/admin/email_blocklist.py +++ b/bookwyrm/views/admin/email_blocklist.py @@ -22,7 +22,9 @@ class EmailBlocklist(View): "domains": models.EmailBlocklist.objects.order_by("-created_date").all(), "form": forms.EmailBlocklistForm(), } - return TemplateResponse(request, "settings/email_blocklist.html", data) + return TemplateResponse( + request, "settings/email_blocklist/email_blocklist.html", data + ) def post(self, request, domain_id=None): """create a new domain block""" @@ -35,11 +37,15 @@ class EmailBlocklist(View): "form": form, } if not form.is_valid(): - return TemplateResponse(request, "settings/email_blocklist.html", data) + return TemplateResponse( + request, "settings/email_blocklist/email_blocklist.html", data + ) form.save() data["form"] = forms.EmailBlocklistForm() - return TemplateResponse(request, "settings/email_blocklist.html", data) + return TemplateResponse( + request, "settings/email_blocklist/email_blocklist.html", data + ) # pylint: disable=unused-argument def delete(self, request, domain_id): diff --git a/bookwyrm/views/admin/federation.py b/bookwyrm/views/admin/federation.py index 97dfd6ff0..19bba30d6 100644 --- a/bookwyrm/views/admin/federation.py +++ b/bookwyrm/views/admin/federation.py @@ -44,7 +44,7 @@ class Federation(View): "sort": sort, "form": forms.ServerForm(), } - return TemplateResponse(request, "settings/federation.html", data) + return TemplateResponse(request, "settings/federation/instance_list.html", data) class AddFederatedServer(View): @@ -53,14 +53,16 @@ class AddFederatedServer(View): def get(self, request): """add server form""" data = {"form": forms.ServerForm()} - return TemplateResponse(request, "settings/edit_server.html", data) + return TemplateResponse(request, "settings/federation/edit_instance.html", data) def post(self, request): """add a server from the admin panel""" form = forms.ServerForm(request.POST) if not form.is_valid(): data = {"form": form} - return TemplateResponse(request, "settings/edit_server.html", data) + return TemplateResponse( + request, "settings/federation/edit_instance.html", data + ) server = form.save() return redirect("settings-federated-server", server.id) @@ -75,7 +77,7 @@ class ImportServerBlocklist(View): def get(self, request): """add server form""" - return TemplateResponse(request, "settings/server_blocklist.html") + return TemplateResponse(request, "settings/federation/instance_blocklist.html") def post(self, request): """add a server from the admin panel""" @@ -98,7 +100,9 @@ class ImportServerBlocklist(View): server.block() success_count += 1 data = {"failed": failed, "succeeded": success_count} - return TemplateResponse(request, "settings/server_blocklist.html", data) + return TemplateResponse( + request, "settings/federation/instance_blocklist.html", data + ) @method_decorator(login_required, name="dispatch") @@ -123,7 +127,7 @@ class FederatedServer(View): user_subject__in=users.all() ), } - return TemplateResponse(request, "settings/federated_server.html", data) + return TemplateResponse(request, "settings/federation/instance.html", data) def post(self, request, server): # pylint: disable=unused-argument """update note""" diff --git a/bookwyrm/views/admin/invite.py b/bookwyrm/views/admin/invite.py index f4c82e485..8a3db61a9 100644 --- a/bookwyrm/views/admin/invite.py +++ b/bookwyrm/views/admin/invite.py @@ -45,7 +45,7 @@ class ManageInvites(View): ), "form": forms.CreateInviteForm(), } - return TemplateResponse(request, "settings/manage_invites.html", data) + return TemplateResponse(request, "settings/invites/manage_invites.html", data) def post(self, request): """creates an invite database entry""" @@ -64,7 +64,7 @@ class ManageInvites(View): PAGE_LENGTH, ) data = {"invites": paginated.page(1), "form": form} - return TemplateResponse(request, "settings/manage_invites.html", data) + return TemplateResponse(request, "settings/invites/manage_invites.html", data) class Invite(View): @@ -135,7 +135,9 @@ class ManageInviteRequests(View): ), "sort": sort, } - return TemplateResponse(request, "settings/manage_invite_requests.html", data) + return TemplateResponse( + request, "settings/invites/manage_invite_requests.html", data + ) def post(self, request): """send out an invite""" diff --git a/bookwyrm/views/admin/ip_blocklist.py b/bookwyrm/views/admin/ip_blocklist.py index 643dae22c..d57a2422c 100644 --- a/bookwyrm/views/admin/ip_blocklist.py +++ b/bookwyrm/views/admin/ip_blocklist.py @@ -22,7 +22,9 @@ class IPBlocklist(View): "addresses": models.IPBlocklist.objects.all(), "form": forms.IPBlocklistForm(), } - return TemplateResponse(request, "settings/ip_blocklist.html", data) + return TemplateResponse( + request, "settings/ip_blocklist/ip_blocklist.html", data + ) def post(self, request, block_id=None): """create a new ip address block""" @@ -35,11 +37,15 @@ class IPBlocklist(View): "form": form, } if not form.is_valid(): - return TemplateResponse(request, "settings/ip_blocklist.html", data) + return TemplateResponse( + request, "settings/ip_blocklist/ip_blocklist.html", data + ) form.save() data["form"] = forms.IPBlocklistForm() - return TemplateResponse(request, "settings/ip_blocklist.html", data) + return TemplateResponse( + request, "settings/ip_blocklist/ip_blocklist.html", data + ) # pylint: disable=unused-argument def delete(self, request, domain_id): From a1a1fd90a118b65ca616dc32b7ab05f795ca4c11 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Tue, 28 Sep 2021 12:41:07 -0700 Subject: [PATCH 04/24] Moves reports into settings directory --- .../templates/{moderation => settings/reports}/report.html | 2 +- .../{moderation => settings/reports}/report_modal.html | 0 .../{moderation => settings/reports}/report_preview.html | 0 .../templates/{moderation => settings/reports}/reports.html | 2 +- bookwyrm/views/admin/reports.py | 4 ++-- 5 files changed, 4 insertions(+), 4 deletions(-) rename bookwyrm/templates/{moderation => settings/reports}/report.html (96%) rename bookwyrm/templates/{moderation => settings/reports}/report_modal.html (100%) rename bookwyrm/templates/{moderation => settings/reports}/report_preview.html (100%) rename bookwyrm/templates/{moderation => settings/reports}/reports.html (94%) diff --git a/bookwyrm/templates/moderation/report.html b/bookwyrm/templates/settings/reports/report.html similarity index 96% rename from bookwyrm/templates/moderation/report.html rename to bookwyrm/templates/settings/reports/report.html index d0e4026a7..88f0f04c6 100644 --- a/bookwyrm/templates/moderation/report.html +++ b/bookwyrm/templates/settings/reports/report.html @@ -11,7 +11,7 @@

- {% include 'moderation/report_preview.html' with report=report %} + {% include 'settings/reports/report_preview.html' with report=report %}
{% include 'user_admin/user_info.html' with user=report.user %} diff --git a/bookwyrm/templates/moderation/report_modal.html b/bookwyrm/templates/settings/reports/report_modal.html similarity index 100% rename from bookwyrm/templates/moderation/report_modal.html rename to bookwyrm/templates/settings/reports/report_modal.html diff --git a/bookwyrm/templates/moderation/report_preview.html b/bookwyrm/templates/settings/reports/report_preview.html similarity index 100% rename from bookwyrm/templates/moderation/report_preview.html rename to bookwyrm/templates/settings/reports/report_preview.html diff --git a/bookwyrm/templates/moderation/reports.html b/bookwyrm/templates/settings/reports/reports.html similarity index 94% rename from bookwyrm/templates/moderation/reports.html rename to bookwyrm/templates/settings/reports/reports.html index c83f626fa..cd350470a 100644 --- a/bookwyrm/templates/moderation/reports.html +++ b/bookwyrm/templates/settings/reports/reports.html @@ -39,7 +39,7 @@ {% for report in reports %}
- {% include 'moderation/report_preview.html' with report=report %} + {% include 'settings/reports/report_preview.html' with report=report %}
{% endfor %} diff --git a/bookwyrm/views/admin/reports.py b/bookwyrm/views/admin/reports.py index 23bb6fa3d..f72d7970b 100644 --- a/bookwyrm/views/admin/reports.py +++ b/bookwyrm/views/admin/reports.py @@ -40,7 +40,7 @@ class Reports(View): "server": server, "reports": models.Report.objects.filter(**filters), } - return TemplateResponse(request, "moderation/reports.html", data) + return TemplateResponse(request, "settings/reports/reports.html", data) @method_decorator(login_required, name="dispatch") @@ -60,7 +60,7 @@ class Report(View): data = { "report": get_object_or_404(models.Report, id=report_id), } - return TemplateResponse(request, "moderation/report.html", data) + return TemplateResponse(request, "settings/reports/report.html", data) def post(self, request, report_id): """comment on a report""" From 9b091eaf75d7d39f0ca0a5273e4c0fdeac43c9b4 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Tue, 28 Sep 2021 12:46:38 -0700 Subject: [PATCH 05/24] Moves user admin templates into settings directory --- .../{user_admin => settings/users}/delete_user_form.html | 0 .../{user_admin => settings/users}/server_filter.html | 0 bookwyrm/templates/{user_admin => settings/users}/user.html | 4 ++-- .../{user_admin => settings/users}/user_admin.html | 2 +- .../{user_admin => settings/users}/user_admin_filters.html | 4 ++-- .../templates/{user_admin => settings/users}/user_info.html | 0 .../users}/user_moderation_actions.html | 2 +- .../{user_admin => settings/users}/username_filter.html | 0 bookwyrm/views/admin/user_admin.py | 6 +++--- 9 files changed, 9 insertions(+), 9 deletions(-) rename bookwyrm/templates/{user_admin => settings/users}/delete_user_form.html (100%) rename bookwyrm/templates/{user_admin => settings/users}/server_filter.html (100%) rename bookwyrm/templates/{user_admin => settings/users}/user.html (69%) rename bookwyrm/templates/{user_admin => settings/users}/user_admin.html (97%) rename bookwyrm/templates/{user_admin => settings/users}/user_admin_filters.html (59%) rename bookwyrm/templates/{user_admin => settings/users}/user_info.html (100%) rename bookwyrm/templates/{user_admin => settings/users}/user_moderation_actions.html (95%) rename bookwyrm/templates/{user_admin => settings/users}/username_filter.html (100%) diff --git a/bookwyrm/templates/user_admin/delete_user_form.html b/bookwyrm/templates/settings/users/delete_user_form.html similarity index 100% rename from bookwyrm/templates/user_admin/delete_user_form.html rename to bookwyrm/templates/settings/users/delete_user_form.html diff --git a/bookwyrm/templates/user_admin/server_filter.html b/bookwyrm/templates/settings/users/server_filter.html similarity index 100% rename from bookwyrm/templates/user_admin/server_filter.html rename to bookwyrm/templates/settings/users/server_filter.html diff --git a/bookwyrm/templates/user_admin/user.html b/bookwyrm/templates/settings/users/user.html similarity index 69% rename from bookwyrm/templates/user_admin/user.html rename to bookwyrm/templates/settings/users/user.html index e3a2413a9..50dcbb143 100644 --- a/bookwyrm/templates/user_admin/user.html +++ b/bookwyrm/templates/settings/users/user.html @@ -11,9 +11,9 @@ {% endblock %} {% block panel %} -{% include 'user_admin/user_info.html' with user=user %} +{% include 'settings/users/user_info.html' with user=user %} -{% include 'user_admin/user_moderation_actions.html' with user=user %} +{% include 'settings/users/user_moderation_actions.html' with user=user %} {% endblock %} diff --git a/bookwyrm/templates/user_admin/user_admin.html b/bookwyrm/templates/settings/users/user_admin.html similarity index 97% rename from bookwyrm/templates/user_admin/user_admin.html rename to bookwyrm/templates/settings/users/user_admin.html index 024ebfecf..874ce8182 100644 --- a/bookwyrm/templates/user_admin/user_admin.html +++ b/bookwyrm/templates/settings/users/user_admin.html @@ -13,7 +13,7 @@ {% block panel %} -{% include 'user_admin/user_admin_filters.html' %} +{% include 'settings/users/user_admin_filters.html' %}
diff --git a/bookwyrm/templates/user_admin/user_admin_filters.html b/bookwyrm/templates/settings/users/user_admin_filters.html similarity index 59% rename from bookwyrm/templates/user_admin/user_admin_filters.html rename to bookwyrm/templates/settings/users/user_admin_filters.html index c9c7a93fc..48a3b7c8a 100644 --- a/bookwyrm/templates/user_admin/user_admin_filters.html +++ b/bookwyrm/templates/settings/users/user_admin_filters.html @@ -1,7 +1,7 @@ {% extends 'snippets/filters_panel/filters_panel.html' %} {% block filter_fields %} -{% include 'user_admin/username_filter.html' %} +{% include 'settings/users/username_filter.html' %} {% include 'directory/community_filter.html' %} -{% include 'user_admin/server_filter.html' %} +{% include 'settings/users/server_filter.html' %} {% endblock %} diff --git a/bookwyrm/templates/user_admin/user_info.html b/bookwyrm/templates/settings/users/user_info.html similarity index 100% rename from bookwyrm/templates/user_admin/user_info.html rename to bookwyrm/templates/settings/users/user_info.html diff --git a/bookwyrm/templates/user_admin/user_moderation_actions.html b/bookwyrm/templates/settings/users/user_moderation_actions.html similarity index 95% rename from bookwyrm/templates/user_admin/user_moderation_actions.html rename to bookwyrm/templates/settings/users/user_moderation_actions.html index 12b70d3ca..a976359f4 100644 --- a/bookwyrm/templates/user_admin/user_moderation_actions.html +++ b/bookwyrm/templates/settings/users/user_moderation_actions.html @@ -36,7 +36,7 @@ {% if user.local %}
- {% include "user_admin/delete_user_form.html" with controls_text="delete_user" class="mt-2 mb-2" %} + {% include "settings/users/delete_user_form.html" with controls_text="delete_user" class="mt-2 mb-2" %}
{% endif %} diff --git a/bookwyrm/templates/user_admin/username_filter.html b/bookwyrm/templates/settings/users/username_filter.html similarity index 100% rename from bookwyrm/templates/user_admin/username_filter.html rename to bookwyrm/templates/settings/users/username_filter.html diff --git a/bookwyrm/views/admin/user_admin.py b/bookwyrm/views/admin/user_admin.py index b29214e73..aa8479590 100644 --- a/bookwyrm/views/admin/user_admin.py +++ b/bookwyrm/views/admin/user_admin.py @@ -57,7 +57,7 @@ class UserAdminList(View): "sort": sort, "server": server, } - return TemplateResponse(request, "user_admin/user_admin.html", data) + return TemplateResponse(request, "settings/users/user_admin.html", data) @method_decorator(login_required, name="dispatch") @@ -72,7 +72,7 @@ class UserAdmin(View): """user view""" user = get_object_or_404(models.User, id=user) data = {"user": user, "group_form": forms.UserGroupForm()} - return TemplateResponse(request, "user_admin/user.html", data) + return TemplateResponse(request, "settings/users/user.html", data) def post(self, request, user): """update user group""" @@ -81,4 +81,4 @@ class UserAdmin(View): if form.is_valid(): form.save() data = {"user": user, "group_form": form} - return TemplateResponse(request, "user_admin/user.html", data) + return TemplateResponse(request, "settings/users/user.html", data) From 6c73c94fce0799aed9f10b69ec119f873cc21c9a Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Tue, 28 Sep 2021 12:53:17 -0700 Subject: [PATCH 06/24] Move site settings sub-tabs to the site.html template --- bookwyrm/templates/settings/layout.html | 9 +-------- bookwyrm/templates/settings/site.html | 9 +++++++++ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/bookwyrm/templates/settings/layout.html b/bookwyrm/templates/settings/layout.html index dd315347d..d7a840af5 100644 --- a/bookwyrm/templates/settings/layout.html +++ b/bookwyrm/templates/settings/layout.html @@ -74,14 +74,7 @@
  • {% url 'settings-site' as url %} {% trans "Site Settings" %} - {% if url in request.path %} - - {% endif %} + {% block site-subtabs %}{% endblock %}
  • {% endif %} diff --git a/bookwyrm/templates/settings/site.html b/bookwyrm/templates/settings/site.html index 508954857..37a344145 100644 --- a/bookwyrm/templates/settings/site.html +++ b/bookwyrm/templates/settings/site.html @@ -5,6 +5,15 @@ {% block header %}{% trans "Site Settings" %}{% endblock %} +{% block site-subtabs %} + +{% endblock %} + {% block panel %}
    From b3fdd1ad51809775f0ad3d2d47a2d53483adc178 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Tue, 28 Sep 2021 13:02:09 -0700 Subject: [PATCH 07/24] Puts sections into boxes on site page --- bookwyrm/templates/preferences/edit_user.html | 4 +- bookwyrm/templates/settings/site.html | 151 +++++++++--------- 2 files changed, 80 insertions(+), 75 deletions(-) diff --git a/bookwyrm/templates/preferences/edit_user.html b/bookwyrm/templates/preferences/edit_user.html index c51ef3631..f3cabbc78 100644 --- a/bookwyrm/templates/preferences/edit_user.html +++ b/bookwyrm/templates/preferences/edit_user.html @@ -62,7 +62,7 @@ -
    +

    {% trans "Display preferences" %}

    @@ -94,7 +94,7 @@
    -
    +

    {% trans "Privacy" %}

    diff --git a/bookwyrm/templates/settings/site.html b/bookwyrm/templates/settings/site.html index 37a344145..da5b7705f 100644 --- a/bookwyrm/templates/settings/site.html +++ b/bookwyrm/templates/settings/site.html @@ -15,35 +15,36 @@ {% endblock %} {% block panel %} - {% csrf_token %}

    {% trans "Instance Info" %}

    -
    - - {{ site_form.name }} -
    -
    - - {{ site_form.instance_tagline }} -
    -
    - - {{ site_form.instance_description }} -
    -
    - -

    {% trans "Used when the instance is previewed on joinbookwyrm.com. Does not support html or markdown." %}

    - {{ site_form.instance_short_description }} -
    -
    - - {{ site_form.code_of_conduct }} -
    -
    - - {{ site_form.privacy_policy }} +
    +
    + + {{ site_form.name }} +
    +
    + + {{ site_form.instance_tagline }} +
    +
    + + {{ site_form.instance_description }} +
    +
    + +

    {% trans "Used when the instance is previewed on joinbookwyrm.com. Does not support html or markdown." %}

    + {{ site_form.instance_short_description }} +
    +
    + + {{ site_form.code_of_conduct }} +
    +
    + + {{ site_form.privacy_policy }} +
    @@ -51,16 +52,16 @@

    {% trans "Images" %}

    -
    -
    +
    +
    {{ site_form.logo }}
    -
    +
    {{ site_form.logo_small }}
    -
    +
    {{ site_form.favicon }}
    @@ -71,21 +72,23 @@ @@ -93,35 +96,37 @@

    {% trans "Registration" %}

    -
    - -
    -
    - -
    -
    - -

    {% trans "(Recommended if registration is open)" %}

    -
    -
    - - {{ site_form.registration_closed_text }} -
    -
    - - {{ site_form.invite_request_text }} - {% for error in site_form.invite_request_text.errors %} -

    {{ error|escape }}

    - {% endfor %} +
    +
    + +
    +
    + +
    +
    + +

    {% trans "(Recommended if registration is open)" %}

    +
    +
    + + {{ site_form.registration_closed_text }} +
    +
    + + {{ site_form.invite_request_text }} + {% for error in site_form.invite_request_text.errors %} +

    {{ error|escape }}

    + {% endfor %} +
    From 57044d1c2058698863a979e87cffaa6ce724863c Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Tue, 28 Sep 2021 13:04:36 -0700 Subject: [PATCH 08/24] Adds null state for ip blocklist --- bookwyrm/templates/settings/ip_blocklist/ip_blocklist.html | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bookwyrm/templates/settings/ip_blocklist/ip_blocklist.html b/bookwyrm/templates/settings/ip_blocklist/ip_blocklist.html index 56a78ac1f..dd8aa759f 100644 --- a/bookwyrm/templates/settings/ip_blocklist/ip_blocklist.html +++ b/bookwyrm/templates/settings/ip_blocklist/ip_blocklist.html @@ -43,5 +43,8 @@
    {% endfor %}
    +{% if not addresses.exists %} +

    {% trans "No IP addresses currently blocked." %}

    +{% endif %} {% endblock %} From de5daf805752af03466b2c89645023f7a23bcf84 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Tue, 28 Sep 2021 13:05:45 -0700 Subject: [PATCH 09/24] Adds email blocklist null state --- .../templates/settings/email_blocklist/email_blocklist.html | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bookwyrm/templates/settings/email_blocklist/email_blocklist.html b/bookwyrm/templates/settings/email_blocklist/email_blocklist.html index 4f7bbf4ba..b8258a1dd 100644 --- a/bookwyrm/templates/settings/email_blocklist/email_blocklist.html +++ b/bookwyrm/templates/settings/email_blocklist/email_blocklist.html @@ -57,5 +57,9 @@ {% endfor %} +{% if not domains.exists %} +

    No email domains currenly blocked.

    +{% endif %} + {% endblock %} From 5b97135155bda28119e12cc96be3b918e70a30a8 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Tue, 28 Sep 2021 13:07:57 -0700 Subject: [PATCH 10/24] Fixes reference to filters template --- bookwyrm/templates/settings/reports/reports.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bookwyrm/templates/settings/reports/reports.html b/bookwyrm/templates/settings/reports/reports.html index cd350470a..c72fd03d0 100644 --- a/bookwyrm/templates/settings/reports/reports.html +++ b/bookwyrm/templates/settings/reports/reports.html @@ -30,7 +30,7 @@
    -{% include 'user_admin/user_admin_filters.html' %} +{% include 'settings/users/user_admin_filters.html' %}
    {% if not reports %} From c5746bbce089273f26473fb38040a954ac1d0ac9 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Tue, 28 Sep 2021 13:10:27 -0700 Subject: [PATCH 11/24] Adds federation null state --- bookwyrm/templates/settings/federation/instance_list.html | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bookwyrm/templates/settings/federation/instance_list.html b/bookwyrm/templates/settings/federation/instance_list.html index ffbabca35..daf713bd7 100644 --- a/bookwyrm/templates/settings/federation/instance_list.html +++ b/bookwyrm/templates/settings/federation/instance_list.html @@ -61,5 +61,11 @@ {% endfor %} +{% if not servers %} +
    + {% trans "No instances found." %} +
    +{% endif %} + {% include 'snippets/pagination.html' with page=servers path=request.path %} {% endblock %} From 67a4b2713a6ea5f35b7345e1f052f411eef43edd Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Tue, 28 Sep 2021 13:18:27 -0700 Subject: [PATCH 12/24] Use in-table style for null states --- .../templates/settings/announcements/announcements.html | 7 +++---- .../settings/email_blocklist/email_blocklist.html | 6 +++--- bookwyrm/templates/settings/federation/instance_list.html | 8 +++----- .../settings/invites/manage_invite_requests.html | 2 +- .../templates/settings/ip_blocklist/ip_blocklist.html | 6 +++--- 5 files changed, 13 insertions(+), 16 deletions(-) diff --git a/bookwyrm/templates/settings/announcements/announcements.html b/bookwyrm/templates/settings/announcements/announcements.html index 2c97b0531..c86ecf3e8 100644 --- a/bookwyrm/templates/settings/announcements/announcements.html +++ b/bookwyrm/templates/settings/announcements/announcements.html @@ -48,11 +48,10 @@ {% if announcement.active %}{% trans "active" %}{% else %}{% trans "inactive" %}{% endif %} {% endfor %} + {% if not announcements %} + {% trans "No announcements found" %} + {% endif %} - - {% if not announcements %} -

    {% trans "No announcements found." %}

    - {% endif %}
    {% include 'snippets/pagination.html' with page=announcements path=request.path %} diff --git a/bookwyrm/templates/settings/email_blocklist/email_blocklist.html b/bookwyrm/templates/settings/email_blocklist/email_blocklist.html index b8258a1dd..888f6a286 100644 --- a/bookwyrm/templates/settings/email_blocklist/email_blocklist.html +++ b/bookwyrm/templates/settings/email_blocklist/email_blocklist.html @@ -55,11 +55,11 @@ {% endfor %} + {% if not domains.exists %} + {% trans "No email domains currently blocked" %} + {% endif %} -{% if not domains.exists %} -

    No email domains currenly blocked.

    -{% endif %} {% endblock %} diff --git a/bookwyrm/templates/settings/federation/instance_list.html b/bookwyrm/templates/settings/federation/instance_list.html index daf713bd7..61afb3177 100644 --- a/bookwyrm/templates/settings/federation/instance_list.html +++ b/bookwyrm/templates/settings/federation/instance_list.html @@ -59,13 +59,11 @@ {{ server.get_status_display }} {% endfor %} + {% if not servers %} + {% trans "No instances found" %} + {% endif %} -{% if not servers %} -
    - {% trans "No instances found." %} -
    -{% endif %} {% include 'snippets/pagination.html' with page=servers path=request.path %} {% endblock %} diff --git a/bookwyrm/templates/settings/invites/manage_invite_requests.html b/bookwyrm/templates/settings/invites/manage_invite_requests.html index 10b9bb50f..fb7c0b1fb 100644 --- a/bookwyrm/templates/settings/invites/manage_invite_requests.html +++ b/bookwyrm/templates/settings/invites/manage_invite_requests.html @@ -47,7 +47,7 @@ {% trans "Action" %} {% if not requests %} - {% trans "No requests" %} + {% trans "No requests" %} {% endif %} {% for req in requests %} diff --git a/bookwyrm/templates/settings/ip_blocklist/ip_blocklist.html b/bookwyrm/templates/settings/ip_blocklist/ip_blocklist.html index dd8aa759f..239baa84e 100644 --- a/bookwyrm/templates/settings/ip_blocklist/ip_blocklist.html +++ b/bookwyrm/templates/settings/ip_blocklist/ip_blocklist.html @@ -42,9 +42,9 @@ {% endfor %} + {% if not addresses.exists %} + {% trans "No IP addresses currently blocked" %} + {% endif %} -{% if not addresses.exists %} -

    {% trans "No IP addresses currently blocked." %}

    -{% endif %} {% endblock %} From fa0e3cc1124a752540ad67e10fa5a3ef5dd195d6 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Tue, 28 Sep 2021 13:21:51 -0700 Subject: [PATCH 13/24] Creates admin views test directory --- bookwyrm/tests/views/admin/__init__.py | 1 + bookwyrm/tests/views/{ => admin}/test_announcements.py | 0 bookwyrm/tests/views/{ => admin}/test_dashboard.py | 0 bookwyrm/tests/views/{ => admin}/test_email_blocks.py | 0 bookwyrm/tests/views/{ => admin}/test_federation.py | 0 bookwyrm/tests/views/{ => admin}/test_reports.py | 0 bookwyrm/tests/views/{ => admin}/test_user_admin.py | 0 7 files changed, 1 insertion(+) create mode 100644 bookwyrm/tests/views/admin/__init__.py rename bookwyrm/tests/views/{ => admin}/test_announcements.py (100%) rename bookwyrm/tests/views/{ => admin}/test_dashboard.py (100%) rename bookwyrm/tests/views/{ => admin}/test_email_blocks.py (100%) rename bookwyrm/tests/views/{ => admin}/test_federation.py (100%) rename bookwyrm/tests/views/{ => admin}/test_reports.py (100%) rename bookwyrm/tests/views/{ => admin}/test_user_admin.py (100%) diff --git a/bookwyrm/tests/views/admin/__init__.py b/bookwyrm/tests/views/admin/__init__.py new file mode 100644 index 000000000..b6e690fd5 --- /dev/null +++ b/bookwyrm/tests/views/admin/__init__.py @@ -0,0 +1 @@ +from . import * diff --git a/bookwyrm/tests/views/test_announcements.py b/bookwyrm/tests/views/admin/test_announcements.py similarity index 100% rename from bookwyrm/tests/views/test_announcements.py rename to bookwyrm/tests/views/admin/test_announcements.py diff --git a/bookwyrm/tests/views/test_dashboard.py b/bookwyrm/tests/views/admin/test_dashboard.py similarity index 100% rename from bookwyrm/tests/views/test_dashboard.py rename to bookwyrm/tests/views/admin/test_dashboard.py diff --git a/bookwyrm/tests/views/test_email_blocks.py b/bookwyrm/tests/views/admin/test_email_blocks.py similarity index 100% rename from bookwyrm/tests/views/test_email_blocks.py rename to bookwyrm/tests/views/admin/test_email_blocks.py diff --git a/bookwyrm/tests/views/test_federation.py b/bookwyrm/tests/views/admin/test_federation.py similarity index 100% rename from bookwyrm/tests/views/test_federation.py rename to bookwyrm/tests/views/admin/test_federation.py diff --git a/bookwyrm/tests/views/test_reports.py b/bookwyrm/tests/views/admin/test_reports.py similarity index 100% rename from bookwyrm/tests/views/test_reports.py rename to bookwyrm/tests/views/admin/test_reports.py diff --git a/bookwyrm/tests/views/test_user_admin.py b/bookwyrm/tests/views/admin/test_user_admin.py similarity index 100% rename from bookwyrm/tests/views/test_user_admin.py rename to bookwyrm/tests/views/admin/test_user_admin.py From 8e3f6657fc5322fe4e6365221f1c03e3258062a8 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Tue, 28 Sep 2021 13:24:25 -0700 Subject: [PATCH 14/24] Fixes edit instance template name --- .../federation/{edit_instances.html => edit_instance.html} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename bookwyrm/templates/settings/federation/{edit_instances.html => edit_instance.html} (100%) diff --git a/bookwyrm/templates/settings/federation/edit_instances.html b/bookwyrm/templates/settings/federation/edit_instance.html similarity index 100% rename from bookwyrm/templates/settings/federation/edit_instances.html rename to bookwyrm/templates/settings/federation/edit_instance.html From 27e6cff0f396af16c4fa2be7aaa4ea30b1bd5dad Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Tue, 28 Sep 2021 13:27:03 -0700 Subject: [PATCH 15/24] Change field display order on edit instance page --- bookwyrm/templates/settings/federation/edit_instance.html | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bookwyrm/templates/settings/federation/edit_instance.html b/bookwyrm/templates/settings/federation/edit_instance.html index 452316e43..fc33302e6 100644 --- a/bookwyrm/templates/settings/federation/edit_instance.html +++ b/bookwyrm/templates/settings/federation/edit_instance.html @@ -33,6 +33,8 @@

    {{ error | escape }}

    {% endfor %}
    + +
    @@ -43,6 +45,8 @@
    + +
    @@ -51,6 +55,8 @@

    {{ error | escape }}

    {% endfor %}
    +
    +
    From 538ae015cdb1ef90070f66b25aff15509fb33e69 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Tue, 28 Sep 2021 13:32:23 -0700 Subject: [PATCH 16/24] Fixes report template paths --- bookwyrm/templates/settings/reports/report.html | 4 ++-- bookwyrm/templates/snippets/report_button.html | 2 +- .../{settings/reports => snippets}/report_modal.html | 0 3 files changed, 3 insertions(+), 3 deletions(-) rename bookwyrm/templates/{settings/reports => snippets}/report_modal.html (100%) diff --git a/bookwyrm/templates/settings/reports/report.html b/bookwyrm/templates/settings/reports/report.html index 88f0f04c6..dee273828 100644 --- a/bookwyrm/templates/settings/reports/report.html +++ b/bookwyrm/templates/settings/reports/report.html @@ -14,9 +14,9 @@ {% include 'settings/reports/report_preview.html' with report=report %}
    -{% include 'user_admin/user_info.html' with user=report.user %} +{% include 'settings/users/user_info.html' with user=report.user %} -{% include 'user_admin/user_moderation_actions.html' with user=report.user %} +{% include 'settings/users/user_moderation_actions.html' with user=report.user %}

    {% trans "Moderator Comments" %}

    diff --git a/bookwyrm/templates/snippets/report_button.html b/bookwyrm/templates/snippets/report_button.html index 55001aca5..2638a9fff 100644 --- a/bookwyrm/templates/snippets/report_button.html +++ b/bookwyrm/templates/snippets/report_button.html @@ -6,6 +6,6 @@ {% trans "Report" as button_text %} {% include 'snippets/toggle/toggle_button.html' with class="is-danger is-light is-small is-fullwidth" text=button_text controls_text="report" controls_uid=report_uuid focus="modal_title_report" disabled=is_current %} -{% include 'moderation/report_modal.html' with user=user reporter=request.user controls_text="report" controls_uid=report_uuid %} +{% include 'snippets/report_modal.html' with user=user reporter=request.user controls_text="report" controls_uid=report_uuid %} {% endwith %} diff --git a/bookwyrm/templates/settings/reports/report_modal.html b/bookwyrm/templates/snippets/report_modal.html similarity index 100% rename from bookwyrm/templates/settings/reports/report_modal.html rename to bookwyrm/templates/snippets/report_modal.html From 4a5efab2f8b121cc64c7cc06464deaa65dc18620 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Tue, 28 Sep 2021 13:34:14 -0700 Subject: [PATCH 17/24] Consistent syntax for back to list --- bookwyrm/templates/settings/reports/report.html | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/bookwyrm/templates/settings/reports/report.html b/bookwyrm/templates/settings/reports/report.html index dee273828..37593f3cc 100644 --- a/bookwyrm/templates/settings/reports/report.html +++ b/bookwyrm/templates/settings/reports/report.html @@ -3,12 +3,13 @@ {% load humanize %} {% block title %}{% blocktrans with report_id=report.id username=report.user.username %}Report #{{ report_id }}: {{ username }}{% endblocktrans %}{% endblock %} -{% block header %}{% blocktrans with report_id=report.id username=report.user.username %}Report #{{ report_id }}: {{ username }}{% endblocktrans %}{% endblock %} + +{% block header %} +{% blocktrans with report_id=report.id username=report.user.username %}Report #{{ report_id }}: {{ username }}{% endblocktrans %} +{% trans "Back to reports" %} +{% endblock %} {% block panel %} -
    {% include 'settings/reports/report_preview.html' with report=report %} From 0fa0c1e2d94ab7521b5dd0f9dbded8a3256364e7 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Tue, 28 Sep 2021 13:36:41 -0700 Subject: [PATCH 18/24] Adds IP blocklist render test --- .../tests/views/admin/test_ip_blocklist.py | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 bookwyrm/tests/views/admin/test_ip_blocklist.py diff --git a/bookwyrm/tests/views/admin/test_ip_blocklist.py b/bookwyrm/tests/views/admin/test_ip_blocklist.py new file mode 100644 index 000000000..8bfcfcdfd --- /dev/null +++ b/bookwyrm/tests/views/admin/test_ip_blocklist.py @@ -0,0 +1,40 @@ +""" test for app action functionality """ +from unittest.mock import patch +from django.template.response import TemplateResponse +from django.test import TestCase +from django.test.client import RequestFactory + +from bookwyrm import models, views + + +class IPBlocklistViews(TestCase): + """every response to a get request, html or json""" + + def setUp(self): + """we need basic test data and mocks""" + self.factory = RequestFactory() + with patch("bookwyrm.suggested_users.rerank_suggestions_task.delay"), patch( + "bookwyrm.activitystreams.populate_stream_task.delay" + ): + self.local_user = models.User.objects.create_user( + "mouse@local.com", + "mouse@mouse.mouse", + "password", + local=True, + localname="mouse", + ) + + models.SiteSettings.objects.create() + + def test_blocklist_page_get(self): + """there are so many views, this just makes sure it LOADS""" + view = views.IPBlocklist.as_view() + request = self.factory.get("") + request.user = self.local_user + request.user.is_superuser = True + + result = view(request) + + self.assertIsInstance(result, TemplateResponse) + result.render() + self.assertEqual(result.status_code, 200) From afcd296513f188e896b1137dfa46f368d62f67b9 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Tue, 28 Sep 2021 13:44:49 -0700 Subject: [PATCH 19/24] Test rendered html --- bookwyrm/tests/views/admin/test_dashboard.py | 6 +++++- bookwyrm/tests/views/admin/test_federation.py | 17 ++++++++++++++--- bookwyrm/tests/views/admin/test_ip_blocklist.py | 6 +++++- bookwyrm/tests/views/admin/test_reports.py | 17 ++++++++++++++--- bookwyrm/tests/views/admin/test_user_admin.py | 17 ++++++++++++++--- bookwyrm/tests/views/preferences/test_block.py | 7 ++++++- 6 files changed, 58 insertions(+), 12 deletions(-) diff --git a/bookwyrm/tests/views/admin/test_dashboard.py b/bookwyrm/tests/views/admin/test_dashboard.py index 6ce30c18c..70cc40fe3 100644 --- a/bookwyrm/tests/views/admin/test_dashboard.py +++ b/bookwyrm/tests/views/admin/test_dashboard.py @@ -1,5 +1,6 @@ """ test for app action functionality """ from unittest.mock import patch +from tidylib import tidy_document from django.template.response import TemplateResponse from django.test import TestCase from django.test.client import RequestFactory @@ -34,5 +35,8 @@ class DashboardViews(TestCase): request.user.is_superuser = True result = view(request) self.assertIsInstance(result, TemplateResponse) - result.render() + html = result.render() + _, errors = tidy_document(html.content) + if errors: + raise Exception(errors) self.assertEqual(result.status_code, 200) diff --git a/bookwyrm/tests/views/admin/test_federation.py b/bookwyrm/tests/views/admin/test_federation.py index ebd311d3f..b1cdd3e61 100644 --- a/bookwyrm/tests/views/admin/test_federation.py +++ b/bookwyrm/tests/views/admin/test_federation.py @@ -1,6 +1,8 @@ """ test for app action functionality """ import json from unittest.mock import patch +from tidylib import tidy_document + from django.core.files.uploadedfile import SimpleUploadedFile from django.template.response import TemplateResponse from django.test import TestCase @@ -46,7 +48,10 @@ class FederationViews(TestCase): request.user.is_superuser = True result = view(request) self.assertIsInstance(result, TemplateResponse) - result.render() + html = result.render() + _, errors = tidy_document(html.content) + if errors: + raise Exception(errors) self.assertEqual(result.status_code, 200) def test_server_page(self): @@ -59,7 +64,10 @@ class FederationViews(TestCase): result = view(request, server.id) self.assertIsInstance(result, TemplateResponse) - result.render() + html = result.render() + _, errors = tidy_document(html.content) + if errors: + raise Exception(errors) self.assertEqual(result.status_code, 200) def test_server_page_block(self): @@ -148,7 +156,10 @@ class FederationViews(TestCase): result = view(request) self.assertIsInstance(result, TemplateResponse) - result.render() + html = result.render() + _, errors = tidy_document(html.content) + if errors: + raise Exception(errors) self.assertEqual(result.status_code, 200) def test_add_view_post_create(self): diff --git a/bookwyrm/tests/views/admin/test_ip_blocklist.py b/bookwyrm/tests/views/admin/test_ip_blocklist.py index 8bfcfcdfd..f663e5e20 100644 --- a/bookwyrm/tests/views/admin/test_ip_blocklist.py +++ b/bookwyrm/tests/views/admin/test_ip_blocklist.py @@ -1,5 +1,6 @@ """ test for app action functionality """ from unittest.mock import patch +from tidylib import tidy_document from django.template.response import TemplateResponse from django.test import TestCase from django.test.client import RequestFactory @@ -36,5 +37,8 @@ class IPBlocklistViews(TestCase): result = view(request) self.assertIsInstance(result, TemplateResponse) - result.render() + html = result.render() + _, errors = tidy_document(html.content) + if errors: + raise Exception(errors) self.assertEqual(result.status_code, 200) diff --git a/bookwyrm/tests/views/admin/test_reports.py b/bookwyrm/tests/views/admin/test_reports.py index 9fbeae04a..262fca167 100644 --- a/bookwyrm/tests/views/admin/test_reports.py +++ b/bookwyrm/tests/views/admin/test_reports.py @@ -1,6 +1,8 @@ """ test for app action functionality """ import json from unittest.mock import patch +from tidylib import tidy_document + from django.template.response import TemplateResponse from django.test import TestCase from django.test.client import RequestFactory @@ -42,7 +44,10 @@ class ReportViews(TestCase): result = view(request) self.assertIsInstance(result, TemplateResponse) - result.render() + html = result.render() + _, errors = tidy_document(html.content) + if errors: + raise Exception(errors) self.assertEqual(result.status_code, 200) def test_reports_page_with_data(self): @@ -55,7 +60,10 @@ class ReportViews(TestCase): result = view(request) self.assertIsInstance(result, TemplateResponse) - result.render() + html = result.render() + _, errors = tidy_document(html.content) + if errors: + raise Exception(errors) self.assertEqual(result.status_code, 200) def test_report_page(self): @@ -69,7 +77,10 @@ class ReportViews(TestCase): result = view(request, report.id) self.assertIsInstance(result, TemplateResponse) - result.render() + html = result.render() + _, errors = tidy_document(html.content) + if errors: + raise Exception(errors) self.assertEqual(result.status_code, 200) def test_report_comment(self): diff --git a/bookwyrm/tests/views/admin/test_user_admin.py b/bookwyrm/tests/views/admin/test_user_admin.py index 3917a6fd9..dbda2f5fc 100644 --- a/bookwyrm/tests/views/admin/test_user_admin.py +++ b/bookwyrm/tests/views/admin/test_user_admin.py @@ -1,5 +1,7 @@ """ test for app action functionality """ from unittest.mock import patch +from tidylib import tidy_document + from django.contrib.auth.models import Group from django.template.response import TemplateResponse from django.test import TestCase @@ -34,7 +36,10 @@ class UserAdminViews(TestCase): request.user.is_superuser = True result = view(request) self.assertIsInstance(result, TemplateResponse) - result.render() + html = result.render() + _, errors = tidy_document(html.content) + if errors: + raise Exception(errors) self.assertEqual(result.status_code, 200) def test_user_admin_page(self): @@ -47,7 +52,10 @@ class UserAdminViews(TestCase): result = view(request, self.local_user.id) self.assertIsInstance(result, TemplateResponse) - result.render() + html = result.render() + _, errors = tidy_document(html.content) + if errors: + raise Exception(errors) self.assertEqual(result.status_code, 200) @patch("bookwyrm.suggested_users.rerank_suggestions_task.delay") @@ -69,7 +77,10 @@ class UserAdminViews(TestCase): result = view(request, self.local_user.id) self.assertIsInstance(result, TemplateResponse) - result.render() + html = result.render() + _, errors = tidy_document(html.content) + if errors: + raise Exception(errors) self.assertEqual( list(self.local_user.groups.values_list("name", flat=True)), ["editor"] diff --git a/bookwyrm/tests/views/preferences/test_block.py b/bookwyrm/tests/views/preferences/test_block.py index 1954d8899..6663aa634 100644 --- a/bookwyrm/tests/views/preferences/test_block.py +++ b/bookwyrm/tests/views/preferences/test_block.py @@ -1,5 +1,7 @@ """ test for app action functionality """ from unittest.mock import patch +from tidylib import tidy_document + from django.template.response import TemplateResponse from django.test import TestCase from django.test.client import RequestFactory @@ -44,7 +46,10 @@ class BlockViews(TestCase): request.user = self.local_user result = view(request) self.assertIsInstance(result, TemplateResponse) - result.render() + html = result.render() + _, errors = tidy_document(html.content) + if errors: + raise Exception(errors) self.assertEqual(result.status_code, 200) def test_block_post(self, _): From 29ef6df7149b9ec7e145401ce17631ccbce283f8 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Tue, 28 Sep 2021 13:54:41 -0700 Subject: [PATCH 20/24] Fixes dashboard page for html validator complaints --- .../settings/dashboard/dashboard.html | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/bookwyrm/templates/settings/dashboard/dashboard.html b/bookwyrm/templates/settings/dashboard/dashboard.html index add28d452..fbf3ff72a 100644 --- a/bookwyrm/templates/settings/dashboard/dashboard.html +++ b/bookwyrm/templates/settings/dashboard/dashboard.html @@ -67,27 +67,27 @@
    -
    -
    -
    From 65d7f5081186e83579bca1b2a80cf011d6a05a74 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Tue, 28 Sep 2021 14:15:06 -0700 Subject: [PATCH 21/24] Updates federation tests --- bookwyrm/templates/settings/federation/edit_instance.html | 2 +- bookwyrm/tests/views/admin/test_federation.py | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/bookwyrm/templates/settings/federation/edit_instance.html b/bookwyrm/templates/settings/federation/edit_instance.html index fc33302e6..7c2e6be66 100644 --- a/bookwyrm/templates/settings/federation/edit_instance.html +++ b/bookwyrm/templates/settings/federation/edit_instance.html @@ -68,7 +68,7 @@
    - +
    diff --git a/bookwyrm/tests/views/admin/test_federation.py b/bookwyrm/tests/views/admin/test_federation.py index b1cdd3e61..24ec29cdd 100644 --- a/bookwyrm/tests/views/admin/test_federation.py +++ b/bookwyrm/tests/views/admin/test_federation.py @@ -49,7 +49,10 @@ class FederationViews(TestCase): result = view(request) self.assertIsInstance(result, TemplateResponse) html = result.render() - _, errors = tidy_document(html.content) + _, errors = tidy_document( + html.content, + options={"drop-empty-elements": False, "drop-proprietary-attributes": False} + ) if errors: raise Exception(errors) self.assertEqual(result.status_code, 200) @@ -180,6 +183,7 @@ class FederationViews(TestCase): self.assertEqual(server.application_type, "coolsoft") self.assertEqual(server.status, "blocked") + # pylint: disable=consider-using-with def test_import_blocklist(self): """load a json file with a list of servers to block""" server = models.FederatedServer.objects.create(server_name="hi.there.com") @@ -191,7 +195,7 @@ class FederationViews(TestCase): {"instance": "hi.there.com", "url": "https://explanation.url"}, # existing {"a": "b"}, # invalid ] - json.dump(data, open("file.json", "w")) + json.dump(data, open("file.json", "w")) # pylint: disable=unspecified-encoding view = views.ImportServerBlocklist.as_view() request = self.factory.post( From 2befef7deb3c66bcb72e64e817e83123f29c82c8 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Tue, 28 Sep 2021 14:38:58 -0700 Subject: [PATCH 22/24] Brings federation page html in line with html validator --- .../settings/federation/instance.html | 85 ++++++++----------- bookwyrm/tests/views/admin/test_federation.py | 9 +- 2 files changed, 43 insertions(+), 51 deletions(-) diff --git a/bookwyrm/templates/settings/federation/instance.html b/bookwyrm/templates/settings/federation/instance.html index 6a1a5488c..f0e48a97e 100644 --- a/bookwyrm/templates/settings/federation/instance.html +++ b/bookwyrm/templates/settings/federation/instance.html @@ -19,18 +19,14 @@

    {% trans "Details" %}

    -
    -
    {% trans "Software:" %}
    -
    {{ server.application_type }}
    -
    -
    -
    {% trans "Version:" %}
    -
    {{ server.application_version }}
    -
    -
    -
    {% trans "Status:" %}
    -
    {{ server.get_status_display }}
    -
    +
    {% trans "Software:" %}
    +
    {{ server.application_type }}
    + +
    {% trans "Version:" %}
    +
    {{ server.application_version }}
    + +
    {% trans "Status:" %}
    +
    {{ server.get_status_display }}
    @@ -39,38 +35,32 @@

    {% trans "Activity" %}

    -
    -
    {% trans "Users:" %}
    -
    - {{ users.count }} - {% if server.user_set.count %}({% trans "View all" %}){% endif %} -
    -
    -
    -
    {% trans "Reports:" %}
    -
    - {{ reports.count }} - {% if reports.count %}({% trans "View all" %}){% endif %} -
    -
    -
    -
    {% trans "Followed by us:" %}
    -
    - {{ followed_by_us.count }} -
    -
    -
    -
    {% trans "Followed by them:" %}
    -
    - {{ followed_by_them.count }} -
    -
    -
    -
    {% trans "Blocked by us:" %}
    -
    - {{ blocked_by_us.count }} -
    -
    +
    {% trans "Users:" %}
    +
    + {{ users.count }} + {% if server.user_set.count %}({% trans "View all" %}){% endif %} +
    + +
    {% trans "Reports:" %}
    +
    + {{ reports.count }} + {% if reports.count %}({% trans "View all" %}){% endif %} +
    + +
    {% trans "Followed by us:" %}
    +
    + {{ followed_by_us.count }} +
    + +
    {% trans "Followed by them:" %}
    +
    + {{ followed_by_them.count }} +
    + +
    {% trans "Blocked by us:" %}
    +
    + {{ blocked_by_us.count }} +
    @@ -86,14 +76,13 @@ {% include 'snippets/toggle/open_button.html' with text=button_text icon_with_text="pencil" controls_text="edit_notes" %}
    - {% if server.notes %} -
    {{ server.notes|to_markdown|safe }}
    - {% endif %} + {% trans "No notes" as null_text %} +
    {{ server.notes|to_markdown|default:null_text|safe }}
    {% csrf_token %}

    - +

    {% trans "Cancel" as button_text %} diff --git a/bookwyrm/tests/views/admin/test_federation.py b/bookwyrm/tests/views/admin/test_federation.py index 24ec29cdd..2501a81a1 100644 --- a/bookwyrm/tests/views/admin/test_federation.py +++ b/bookwyrm/tests/views/admin/test_federation.py @@ -51,13 +51,16 @@ class FederationViews(TestCase): html = result.render() _, errors = tidy_document( html.content, - options={"drop-empty-elements": False, "drop-proprietary-attributes": False} + options={ + "drop-empty-elements": False, + "warn-proprietary-attributes": False, + }, ) if errors: raise Exception(errors) self.assertEqual(result.status_code, 200) - def test_server_page(self): + def test_instance_page(self): """there are so many views, this just makes sure it LOADS""" server = models.FederatedServer.objects.create(server_name="hi.there.com") view = views.FederatedServer.as_view() @@ -68,7 +71,7 @@ class FederationViews(TestCase): result = view(request, server.id) self.assertIsInstance(result, TemplateResponse) html = result.render() - _, errors = tidy_document(html.content) + _, errors = tidy_document(html.content, options={"drop-empty-elements": False}) if errors: raise Exception(errors) self.assertEqual(result.status_code, 200) From ada3e1d4d6c7a025d24c900c42e3deee8063efcd Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Tue, 28 Sep 2021 15:01:53 -0700 Subject: [PATCH 23/24] Adds options to html validator and fixes dl/dts --- .../templates/settings/users/user_info.html | 82 +++++++------------ .../tests/views/admin/test_ip_blocklist.py | 2 +- bookwyrm/tests/views/admin/test_reports.py | 18 +++- 3 files changed, 47 insertions(+), 55 deletions(-) diff --git a/bookwyrm/templates/settings/users/user_info.html b/bookwyrm/templates/settings/users/user_info.html index 7ad57e0ef..8d332b1ae 100644 --- a/bookwyrm/templates/settings/users/user_info.html +++ b/bookwyrm/templates/settings/users/user_info.html @@ -48,58 +48,42 @@
    {% if user.local %} -
    -
    {% trans "Email:" %}
    -
    {{ user.email }}
    -
    +
    {% trans "Email:" %}
    +
    {{ user.email }}
    {% endif %} {% with report_count=user.report_set.count %} -
    -
    {% trans "Reports:" %}
    -
    - {{ report_count|intcomma }} - {% if report_count > 0 %} - - {% trans "(View reports)" %} - - {% endif %} -
    -
    +
    {% trans "Reports:" %}
    +
    + {{ report_count|intcomma }} + {% if report_count > 0 %} + + {% trans "(View reports)" %} + + {% endif %} +
    {% endwith %} -
    -
    {% trans "Blocked by count:" %}
    -
    {{ user.blocked_by.count }}
    -
    +
    {% trans "Blocked by count:" %}
    +
    {{ user.blocked_by.count }}
    -
    -
    {% trans "Last active date:" %}
    -
    {{ user.last_active_date }}
    -
    +
    {% trans "Last active date:" %}
    +
    {{ user.last_active_date }}
    -
    -
    {% trans "Manually approved followers:" %}
    -
    {{ user.manually_approves_followers }}
    -
    +
    {% trans "Manually approved followers:" %}
    +
    {{ user.manually_approves_followers }}
    -
    -
    {% trans "Discoverable:" %}
    -
    {{ user.discoverable }}
    -
    +
    {% trans "Discoverable:" %}
    +
    {{ user.discoverable }}
    {% if not user.is_active %} -
    -
    {% trans "Deactivation reason:" %}
    -
    {{ user.deactivation_reason }}
    -
    +
    {% trans "Deactivation reason:" %}
    +
    {{ user.deactivation_reason }}
    {% endif %} {% if not user.is_active and user.deactivation_reason == "pending" %} -
    -
    {% trans "Confirmation code:" %}
    -
    {{ user.confirmation_code }}
    -
    +
    {% trans "Confirmation code:" %}
    +
    {{ user.confirmation_code }}
    {% endif %}
    @@ -113,18 +97,14 @@ {% if server %}
    {{ server.server_name }}
    -
    -
    {% trans "Software:" %}
    -
    {{ server.application_type }}
    -
    -
    -
    {% trans "Version:" %}
    -
    {{ server.application_version }}
    -
    -
    -
    {% trans "Status:" %}
    -
    {{ server.status }}
    -
    +
    {% trans "Software:" %}
    +
    {{ server.application_type }}
    + +
    {% trans "Version:" %}
    +
    {{ server.application_version }}
    + +
    {% trans "Status:" %}
    +
    {{ server.status }}
    {% if server.notes %}
    {% trans "Notes" %}
    diff --git a/bookwyrm/tests/views/admin/test_ip_blocklist.py b/bookwyrm/tests/views/admin/test_ip_blocklist.py index f663e5e20..fb249b761 100644 --- a/bookwyrm/tests/views/admin/test_ip_blocklist.py +++ b/bookwyrm/tests/views/admin/test_ip_blocklist.py @@ -38,7 +38,7 @@ class IPBlocklistViews(TestCase): self.assertIsInstance(result, TemplateResponse) html = result.render() - _, errors = tidy_document(html.content) + _, errors = tidy_document(html.content, options={"drop-empty-elements": False}) if errors: raise Exception(errors) self.assertEqual(result.status_code, 200) diff --git a/bookwyrm/tests/views/admin/test_reports.py b/bookwyrm/tests/views/admin/test_reports.py index 262fca167..456dff554 100644 --- a/bookwyrm/tests/views/admin/test_reports.py +++ b/bookwyrm/tests/views/admin/test_reports.py @@ -45,7 +45,13 @@ class ReportViews(TestCase): result = view(request) self.assertIsInstance(result, TemplateResponse) html = result.render() - _, errors = tidy_document(html.content) + _, errors = tidy_document( + html.content, + options={ + "drop-empty-elements": False, + "warn-proprietary-attributes": False, + }, + ) if errors: raise Exception(errors) self.assertEqual(result.status_code, 200) @@ -61,7 +67,13 @@ class ReportViews(TestCase): result = view(request) self.assertIsInstance(result, TemplateResponse) html = result.render() - _, errors = tidy_document(html.content) + _, errors = tidy_document( + html.content, + options={ + "drop-empty-elements": False, + "warn-proprietary-attributes": False, + }, + ) if errors: raise Exception(errors) self.assertEqual(result.status_code, 200) @@ -78,7 +90,7 @@ class ReportViews(TestCase): self.assertIsInstance(result, TemplateResponse) html = result.render() - _, errors = tidy_document(html.content) + _, errors = tidy_document(html.content, options={"drop-empty-elements": False}) if errors: raise Exception(errors) self.assertEqual(result.status_code, 200) From 5b3ff8469df4a7cb87d53af7f54d1cbf9c260711 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Tue, 28 Sep 2021 15:20:10 -0700 Subject: [PATCH 24/24] Html validation fix for user admin view --- bookwyrm/templates/settings/users/user.html | 5 +---- bookwyrm/tests/views/admin/test_user_admin.py | 6 +++--- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/bookwyrm/templates/settings/users/user.html b/bookwyrm/templates/settings/users/user.html index 50dcbb143..676502e6d 100644 --- a/bookwyrm/templates/settings/users/user.html +++ b/bookwyrm/templates/settings/users/user.html @@ -4,10 +4,7 @@ {% block title %}{{ user.username }}{% endblock %} {% block header %} {{ user.username }} -

    - {% trans "Back to users" %} -

    - +{% trans "Back to users" %} {% endblock %} {% block panel %} diff --git a/bookwyrm/tests/views/admin/test_user_admin.py b/bookwyrm/tests/views/admin/test_user_admin.py index dbda2f5fc..3336cf242 100644 --- a/bookwyrm/tests/views/admin/test_user_admin.py +++ b/bookwyrm/tests/views/admin/test_user_admin.py @@ -37,7 +37,7 @@ class UserAdminViews(TestCase): result = view(request) self.assertIsInstance(result, TemplateResponse) html = result.render() - _, errors = tidy_document(html.content) + _, errors = tidy_document(html.content, options={"drop-empty-elements": False}) if errors: raise Exception(errors) self.assertEqual(result.status_code, 200) @@ -53,7 +53,7 @@ class UserAdminViews(TestCase): self.assertIsInstance(result, TemplateResponse) html = result.render() - _, errors = tidy_document(html.content) + _, errors = tidy_document(html.content, options={"drop-empty-elements": False}) if errors: raise Exception(errors) self.assertEqual(result.status_code, 200) @@ -78,7 +78,7 @@ class UserAdminViews(TestCase): self.assertIsInstance(result, TemplateResponse) html = result.render() - _, errors = tidy_document(html.content) + _, errors = tidy_document(html.content, options={"drop-empty-elements": False}) if errors: raise Exception(errors)