Merge branch 'main' of github.com:willhoh/bookwyrm
This commit is contained in:
@ -38,7 +38,7 @@ class Create(Verb):
|
||||
class Delete(Verb):
|
||||
"""Create activity"""
|
||||
|
||||
to: List[str]
|
||||
to: List[str] = field(default_factory=lambda: [])
|
||||
cc: List[str] = field(default_factory=lambda: [])
|
||||
type: str = "Delete"
|
||||
|
||||
@ -137,8 +137,8 @@ class Accept(Verb):
|
||||
type: str = "Accept"
|
||||
|
||||
def action(self):
|
||||
"""find and remove the activity object"""
|
||||
obj = self.object.to_model(save=False, allow_create=False)
|
||||
"""accept a request"""
|
||||
obj = self.object.to_model(save=False, allow_create=True)
|
||||
obj.accept()
|
||||
|
||||
|
||||
@ -150,7 +150,7 @@ class Reject(Verb):
|
||||
type: str = "Reject"
|
||||
|
||||
def action(self):
|
||||
"""find and remove the activity object"""
|
||||
"""reject a follow request"""
|
||||
obj = self.object.to_model(save=False, allow_create=False)
|
||||
obj.reject()
|
||||
|
||||
|
@ -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))
|
||||
|
||||
|
@ -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"""
|
||||
|
||||
|
@ -2,15 +2,17 @@
|
||||
{% load i18n %}
|
||||
|
||||
{% block filter %}
|
||||
<label class="label is-block" for="id_format">{% trans "Format:" %}</label>
|
||||
<div class="select">
|
||||
<select id="id_format" name="format">
|
||||
<option value="">{% trans "Any" %}</option>
|
||||
{% for format in formats %}{% if format %}
|
||||
<option value="{{ format }}" {% if request.GET.format == format %}selected{% endif %}>
|
||||
{{ format|title }}
|
||||
</option>
|
||||
{% endif %}{% endfor %}
|
||||
</select>
|
||||
<div class="control">
|
||||
<label class="label is-block" for="id_format">{% trans "Format:" %}</label>
|
||||
<div class="select">
|
||||
<select id="id_format" name="format">
|
||||
<option value="">{% trans "Any" %}</option>
|
||||
{% for format in formats %}{% if format %}
|
||||
<option value="{{ format }}" {% if request.GET.format == format %}selected{% endif %}>
|
||||
{{ format|title }}
|
||||
</option>
|
||||
{% endif %}{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
@ -2,15 +2,17 @@
|
||||
{% load i18n %}
|
||||
|
||||
{% block filter %}
|
||||
<label class="label is-block" for="id_language">{% trans "Language:" %}</label>
|
||||
<div class="select">
|
||||
<select id="id_language" name="language">
|
||||
<option value="">{% trans "Any" %}</option>
|
||||
{% for language in languages %}
|
||||
<option value="{{ language }}" {% if request.GET.language == language %}selected{% endif %}>
|
||||
{{ language }}
|
||||
</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
<div class="control">
|
||||
<label class="label is-block" for="id_language">{% trans "Language:" %}</label>
|
||||
<div class="select">
|
||||
<select id="id_language" name="language">
|
||||
<option value="">{% trans "Any" %}</option>
|
||||
{% for language in languages %}
|
||||
<option value="{{ language }}" {% if request.GET.language == language %}selected{% endif %}>
|
||||
{{ language }}
|
||||
</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
@ -2,7 +2,9 @@
|
||||
{% load i18n %}
|
||||
|
||||
{% block filter %}
|
||||
<label class="label" for="id_search">{% trans "Search editions" %}</label>
|
||||
<input type="text" class="input" name="q" value="{{ request.GET.q|default:'' }}" id="id_search">
|
||||
<div class="control">
|
||||
<label class="label" for="id_search">{% trans "Search editions" %}</label>
|
||||
<input type="text" class="input" name="q" value="{{ request.GET.q|default:'' }}" id="id_search">
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
|
@ -17,6 +17,19 @@
|
||||
{% include 'settings/reports/report_preview.html' with report=report %}
|
||||
</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 %}
|
||||
<div class="block">
|
||||
<h3 class="title is-4">{% trans "Reported statuses" %}</h3>
|
||||
@ -68,9 +81,13 @@
|
||||
{% endfor %}
|
||||
<form class="block" name="report-comment" method="post" action="{% url 'settings-report' report.id %}">
|
||||
{% csrf_token %}
|
||||
<label for="report_comment" class="label">Comment on report</label>
|
||||
<textarea name="note" id="report_comment" class="textarea"></textarea>
|
||||
<button class="button">{% trans "Comment" %}</button>
|
||||
<div class="field">
|
||||
<label for="report_comment" class="label">Comment on report</label>
|
||||
<textarea name="note" id="report_comment" class="textarea"></textarea>
|
||||
</div>
|
||||
<div class="field">
|
||||
<button class="button">{% trans "Comment" %}</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
@ -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 %}
|
||||
<textarea
|
||||
name="content"
|
||||
class="textarea save-draft"
|
||||
{% if not draft %}data-cache-draft="id_content_{{ type }}_{{ book.id }}{{ reply_parent.id }}"{% endif %}
|
||||
id="id_content_{{ type }}_{{ book.id }}{{ reply_parent.id }}{{ uuid }}"
|
||||
placeholder="{{ placeholder }}"
|
||||
aria-label="{% if reply_parent %}{% trans 'Reply' %}{% else %}{% trans 'Content' %}{% 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>
|
||||
|
||||
<div class="control">
|
||||
<textarea
|
||||
name="content"
|
||||
class="textarea save-draft"
|
||||
{% if not draft %}data-cache-draft="id_content_{{ type }}_{{ book.id }}{{ reply_parent.id }}"{% endif %}
|
||||
id="id_content_{{ type }}_{{ book.id }}{{ reply_parent.id }}{{ uuid }}"
|
||||
placeholder="{{ placeholder }}"
|
||||
aria-label="{% if reply_parent %}{% trans 'Reply' %}{% else %}{% trans 'Content' %}{% 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 %}{{ prepared_content }}{% firstof draft.raw_content draft.content '' %}</textarea>
|
||||
</div>
|
||||
|
@ -15,7 +15,7 @@
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="column is-narrow">
|
||||
<div class="column is-narrow control">
|
||||
<button class="button is-link" type="submit">
|
||||
<span class="icon icon-spinner" aria-hidden="true"></span>
|
||||
<span>{% trans "Post" %}</span>
|
||||
|
@ -38,9 +38,11 @@
|
||||
{% block filter_fields %}
|
||||
{% endblock %}
|
||||
</div>
|
||||
<button type="submit" class="button is-primary is-small">
|
||||
<div class="control">
|
||||
<button type="submit" class="button is-primary">
|
||||
{% trans "Apply filters" %}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</details>
|
||||
|
@ -22,7 +22,7 @@
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="reporter" value="{{ request.user.id }}">
|
||||
<input type="hidden" name="user" value="{{ user.id }}">
|
||||
{% if status %}
|
||||
{% if status_id %}
|
||||
<input type="hidden" name="statuses" value="{{ status_id }}">
|
||||
{% endif %}
|
||||
{% if link %}
|
||||
|
@ -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 %}
|
||||
|
@ -10,7 +10,9 @@
|
||||
|
||||
{% block dropdown-list %}
|
||||
<li role="menuitem">
|
||||
<a href="{% url 'direct-messages-user' user|username %}" class="button is-fullwidth is-small">{% trans "Send direct message" %}</a>
|
||||
<div class="control">
|
||||
<a href="{% url 'direct-messages-user' user|username %}" class="button is-fullwidth is-small">{% trans "Send direct message" %}</a>
|
||||
</div>
|
||||
</li>
|
||||
<li role="menuitem">
|
||||
{% include 'snippets/report_button.html' with user=user class="is-fullwidth" %}
|
||||
|
@ -58,6 +58,7 @@ class ReportAdmin(View):
|
||||
"""load a report"""
|
||||
data = {
|
||||
"report": get_object_or_404(models.Report, id=report_id),
|
||||
"group_form": forms.UserGroupForm(),
|
||||
}
|
||||
return TemplateResponse(request, "settings/reports/report.html", data)
|
||||
|
||||
|
@ -31,12 +31,13 @@ class User(View):
|
||||
shelf_preview = []
|
||||
|
||||
# only show shelves that should be visible
|
||||
shelves = user.shelf_set
|
||||
is_self = request.user.id == user.id
|
||||
if not is_self:
|
||||
shelves = models.Shelf.privacy_filter(
|
||||
request.user, privacy_levels=["public", "followers"]
|
||||
).filter(user=user, books__isnull=False)
|
||||
else:
|
||||
shelves = user.shelf_set.filter(books__isnull=False).distinct()
|
||||
|
||||
for user_shelf in shelves.all()[:3]:
|
||||
shelf_preview.append(
|
||||
|
Reference in New Issue
Block a user