Merge pull request #1885 from bookwyrm-social/reporting-improvements
Reporting improvements
This commit is contained in:
commit
79be02230b
|
@ -48,7 +48,9 @@ def moderation_report_email(report):
|
||||||
data["reportee"] = report.user.localname or report.user.username
|
data["reportee"] = report.user.localname or report.user.username
|
||||||
data["report_link"] = report.remote_id
|
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
|
data["user"] = admin.display_name
|
||||||
send_email.delay(admin.email, *format_email("moderation_report", data))
|
send_email.delay(admin.email, *format_email("moderation_report", data))
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
""" flagged for moderation """
|
""" flagged for moderation """
|
||||||
from django.db import models
|
from django.db import models
|
||||||
|
from bookwyrm.settings import DOMAIN
|
||||||
from .base_model import BookWyrmModel
|
from .base_model import BookWyrmModel
|
||||||
|
|
||||||
|
|
||||||
|
@ -15,6 +16,9 @@ class Report(BookWyrmModel):
|
||||||
links = models.ManyToManyField("Link", blank=True)
|
links = models.ManyToManyField("Link", blank=True)
|
||||||
resolved = models.BooleanField(default=False)
|
resolved = models.BooleanField(default=False)
|
||||||
|
|
||||||
|
def get_remote_id(self):
|
||||||
|
return f"https://{DOMAIN}/settings/reports/{self.id}"
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
"""set order by default"""
|
"""set order by default"""
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,19 @@
|
||||||
{% include 'settings/reports/report_preview.html' with report=report %}
|
{% include 'settings/reports/report_preview.html' with report=report %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="block">
|
||||||
|
<details class="details-panel box">
|
||||||
|
<summary>
|
||||||
|
<span class="title is-4">{% trans "Message reporter" %}</span>
|
||||||
|
<span class="details-close icon icon-x" aria-hidden></span>
|
||||||
|
</summary>
|
||||||
|
<div class="box">
|
||||||
|
{% 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 %}
|
||||||
|
</div>
|
||||||
|
</details>
|
||||||
|
</div>
|
||||||
|
|
||||||
{% if report.statuses.exists %}
|
{% if report.statuses.exists %}
|
||||||
<div class="block">
|
<div class="block">
|
||||||
<h3 class="title is-4">{% trans "Reported statuses" %}</h3>
|
<h3 class="title is-4">{% trans "Reported statuses" %}</h3>
|
||||||
|
@ -68,9 +81,13 @@
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
<form class="block" name="report-comment" method="post" action="{% url 'settings-report' report.id %}">
|
<form class="block" name="report-comment" method="post" action="{% url 'settings-report' report.id %}">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
|
<div class="field">
|
||||||
<label for="report_comment" class="label">Comment on report</label>
|
<label for="report_comment" class="label">Comment on report</label>
|
||||||
<textarea name="note" id="report_comment" class="textarea"></textarea>
|
<textarea name="note" id="report_comment" class="textarea"></textarea>
|
||||||
|
</div>
|
||||||
|
<div class="field">
|
||||||
<button class="button">{% trans "Comment" %}</button>
|
<button class="button">{% trans "Comment" %}</button>
|
||||||
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -8,6 +8,7 @@ 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
|
mention: a user who is @ mentioned by default in the post
|
||||||
draft: an existing Status object that is providing default values for input fields
|
draft: an existing Status object that is providing default values for input fields
|
||||||
{% endcomment %}
|
{% endcomment %}
|
||||||
|
<div class="control">
|
||||||
<textarea
|
<textarea
|
||||||
name="content"
|
name="content"
|
||||||
class="textarea save-draft"
|
class="textarea save-draft"
|
||||||
|
@ -16,5 +17,5 @@ draft: an existing Status object that is providing default values for input fiel
|
||||||
placeholder="{{ placeholder }}"
|
placeholder="{{ placeholder }}"
|
||||||
aria-label="{% if reply_parent %}{% trans 'Reply' %}{% else %}{% trans 'Content' %}{% endif %}"
|
aria-label="{% if reply_parent %}{% trans 'Reply' %}{% else %}{% trans 'Content' %}{% endif %}"
|
||||||
{% if not optional and type != "quotation" and type != "review" %}required{% endif %}
|
{% if not optional and type != "quotation" and type != "review" %}required{% endif %}
|
||||||
>{% if reply_parent %}{{ reply_parent|mentions:request.user }}{% endif %}{% if mention %}@{{ mention|username }} {% endif %}{% firstof draft.raw_content draft.content '' %}</textarea>
|
>{% if reply_parent %}{{ reply_parent|mentions:request.user }}{% endif %}{% if mention %}@{{ mention|username }} {% endif %}{{ prepared_content }}{% firstof draft.raw_content draft.content '' %}</textarea>
|
||||||
|
</div>
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="column is-narrow">
|
<div class="column is-narrow control">
|
||||||
<button class="button is-link" type="submit">
|
<button class="button is-link" type="submit">
|
||||||
<span class="icon icon-spinner" aria-hidden="true"></span>
|
<span class="icon icon-spinner" aria-hidden="true"></span>
|
||||||
<span>{% trans "Post" %}</span>
|
<span>{% trans "Post" %}</span>
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<input type="hidden" name="reporter" value="{{ request.user.id }}">
|
<input type="hidden" name="reporter" value="{{ request.user.id }}">
|
||||||
<input type="hidden" name="user" value="{{ user.id }}">
|
<input type="hidden" name="user" value="{{ user.id }}">
|
||||||
{% if status %}
|
{% if status_id %}
|
||||||
<input type="hidden" name="statuses" value="{{ status_id }}">
|
<input type="hidden" name="statuses" value="{{ status_id }}">
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if link %}
|
{% if link %}
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
{% load book_display_tags %}
|
{% load book_display_tags %}
|
||||||
{% load markdown %}
|
{% load markdown %}
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
{% load cache %}
|
|
||||||
|
|
||||||
{% if not hide_book %}
|
{% if not hide_book %}
|
||||||
{% with book=status.book|default:status.mention_books.first %}
|
{% with book=status.book|default:status.mention_books.first %}
|
||||||
|
|
|
@ -58,6 +58,7 @@ class ReportAdmin(View):
|
||||||
"""load a report"""
|
"""load a report"""
|
||||||
data = {
|
data = {
|
||||||
"report": get_object_or_404(models.Report, id=report_id),
|
"report": get_object_or_404(models.Report, id=report_id),
|
||||||
|
"group_form": forms.UserGroupForm(),
|
||||||
}
|
}
|
||||||
return TemplateResponse(request, "settings/reports/report.html", data)
|
return TemplateResponse(request, "settings/reports/report.html", data)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue