From ae53b479f512080c8232cc41be12514f59fa9ac1 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Sun, 30 Jan 2022 08:36:20 -0800 Subject: [PATCH 1/5] Fixes status field on report modal form --- bookwyrm/templates/snippets/report_modal.html | 2 +- bookwyrm/templates/snippets/status/generated_status.html | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/bookwyrm/templates/snippets/report_modal.html b/bookwyrm/templates/snippets/report_modal.html index 7d2e52b6..0cf786ec 100644 --- a/bookwyrm/templates/snippets/report_modal.html +++ b/bookwyrm/templates/snippets/report_modal.html @@ -22,7 +22,7 @@ {% csrf_token %} -{% if status %} +{% if status_id %} {% endif %} {% if link %} diff --git a/bookwyrm/templates/snippets/status/generated_status.html b/bookwyrm/templates/snippets/status/generated_status.html index 4051f2c0..35776b84 100644 --- a/bookwyrm/templates/snippets/status/generated_status.html +++ b/bookwyrm/templates/snippets/status/generated_status.html @@ -3,7 +3,6 @@ {% load book_display_tags %} {% load markdown %} {% load i18n %} -{% load cache %} {% if not hide_book %} {% with book=status.book|default:status.mention_books.first %} From 8a07f5c396797e5e732769cefc97012e19b3dba1 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Sun, 30 Jan 2022 08:50:53 -0800 Subject: [PATCH 2/5] Fixes report remote id --- bookwyrm/models/report.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bookwyrm/models/report.py b/bookwyrm/models/report.py index a9f5b3b1..bd2a1ef0 100644 --- a/bookwyrm/models/report.py +++ b/bookwyrm/models/report.py @@ -1,5 +1,6 @@ """ flagged for moderation """ from django.db import models +from bookwyrm.settings import DOMAIN from .base_model import BookWyrmModel @@ -15,6 +16,9 @@ class Report(BookWyrmModel): links = models.ManyToManyField("Link", blank=True) resolved = models.BooleanField(default=False) + def get_remote_id(self): + return f"https://{DOMAIN}/settings/reports/{self.id}" + class Meta: """set order by default""" From c04bf4638f1eade57f670a71454e7f0598950df0 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Sun, 30 Jan 2022 08:51:14 -0800 Subject: [PATCH 3/5] Avoid duplicate emails --- bookwyrm/emailing.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bookwyrm/emailing.py b/bookwyrm/emailing.py index efef1263..80aca071 100644 --- a/bookwyrm/emailing.py +++ b/bookwyrm/emailing.py @@ -48,7 +48,9 @@ def moderation_report_email(report): data["reportee"] = report.user.localname or report.user.username data["report_link"] = report.remote_id - for admin in models.User.objects.filter(groups__name__in=["admin", "moderator"]): + for admin in models.User.objects.filter( + groups__name__in=["admin", "moderator"] + ).distinct(): data["user"] = admin.display_name send_email.delay(admin.email, *format_email("moderation_report", data)) From 24c1d5a168daf4a1d67b5baae0c25397f87bb3e5 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Sun, 30 Jan 2022 09:15:20 -0800 Subject: [PATCH 4/5] Add prompt to respond to reporter --- .../templates/settings/reports/report.html | 23 ++++++++++++++++--- .../snippets/create_status/content_field.html | 21 +++++++++-------- .../create_status/post_options_block.html | 2 +- 3 files changed, 32 insertions(+), 14 deletions(-) diff --git a/bookwyrm/templates/settings/reports/report.html b/bookwyrm/templates/settings/reports/report.html index 84fafb14..a795273b 100644 --- a/bookwyrm/templates/settings/reports/report.html +++ b/bookwyrm/templates/settings/reports/report.html @@ -17,6 +17,19 @@ {% include 'settings/reports/report_preview.html' with report=report %} +
+
+ + {% trans "Message reporter" %} + + +
+ {% trans "Update on your report:" as dm_template %} + {% include 'snippets/create_status/status.html' with type="direct" uuid=1 mention=report.reporter prepared_content=dm_template no_script=True %} +
+
+
+ {% if report.statuses.exists %}

{% trans "Reported statuses" %}

@@ -68,9 +81,13 @@ {% endfor %}
{% csrf_token %} - - - +
+ + +
+
+ +
{% endblock %} diff --git a/bookwyrm/templates/snippets/create_status/content_field.html b/bookwyrm/templates/snippets/create_status/content_field.html index ea2849d9..cc4205b2 100644 --- a/bookwyrm/templates/snippets/create_status/content_field.html +++ b/bookwyrm/templates/snippets/create_status/content_field.html @@ -8,13 +8,14 @@ reply_parent: if applicable, the Status object that this post is in reply to mention: a user who is @ mentioned by default in the post draft: an existing Status object that is providing default values for input fields {% endcomment %} - - +
+ +
diff --git a/bookwyrm/templates/snippets/create_status/post_options_block.html b/bookwyrm/templates/snippets/create_status/post_options_block.html index 697614e1..17131532 100644 --- a/bookwyrm/templates/snippets/create_status/post_options_block.html +++ b/bookwyrm/templates/snippets/create_status/post_options_block.html @@ -15,7 +15,7 @@ {% endif %} -
+