mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-29 21:11:16 +00:00
Record statuses deleted in reports
This commit is contained in:
parent
affaf3d0ba
commit
c6d23ba26a
3 changed files with 11 additions and 6 deletions
|
@ -18,7 +18,7 @@
|
||||||
|
|
||||||
<div class="card-footer-item">
|
<div class="card-footer-item">
|
||||||
{# moderation options #}
|
{# moderation options #}
|
||||||
<form name="delete-{{ status.id }}" action="/delete-status/{{ status.id }}" method="post">
|
<form name="delete-{{ status.id }}" action="/delete-status/{{ status.id }}/{{ report.id }}" method="post">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<button class="button is-danger is-light" type="submit">
|
<button class="button is-danger is-light" type="submit">
|
||||||
{% trans "Delete status" %}
|
{% trans "Delete status" %}
|
||||||
|
|
|
@ -141,7 +141,7 @@ urlpatterns = [
|
||||||
name="settings-users",
|
name="settings-users",
|
||||||
),
|
),
|
||||||
re_path(
|
re_path(
|
||||||
r"^settings/users/(?P<user>\d+)/(?P<report_id>\d+)??$",
|
r"^settings/users/(?P<user>\d+)/(?P<report_id>\d+)?$",
|
||||||
views.UserAdmin.as_view(),
|
views.UserAdmin.as_view(),
|
||||||
name="settings-user",
|
name="settings-user",
|
||||||
),
|
),
|
||||||
|
@ -633,7 +633,7 @@ urlpatterns = [
|
||||||
name="create-status",
|
name="create-status",
|
||||||
),
|
),
|
||||||
re_path(
|
re_path(
|
||||||
r"^delete-status/(?P<status_id>\d+)/?$",
|
r"^delete-status/(?P<status_id>\d+)/?(?P<report_id>\d+)?$",
|
||||||
views.DeleteStatus.as_view(),
|
views.DeleteStatus.as_view(),
|
||||||
name="delete-status",
|
name="delete-status",
|
||||||
),
|
),
|
||||||
|
|
|
@ -8,7 +8,7 @@ from django.core.validators import URLValidator
|
||||||
from django.core.exceptions import ValidationError
|
from django.core.exceptions import ValidationError
|
||||||
from django.db.models import Q
|
from django.db.models import Q
|
||||||
from django.http import HttpResponse, HttpResponseBadRequest, Http404
|
from django.http import HttpResponse, HttpResponseBadRequest, Http404
|
||||||
from django.shortcuts import get_object_or_404, redirect
|
from django.shortcuts import get_object_or_404
|
||||||
from django.template.response import TemplateResponse
|
from django.template.response import TemplateResponse
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
from django.utils.decorators import method_decorator
|
from django.utils.decorators import method_decorator
|
||||||
|
@ -17,6 +17,7 @@ from django.views.decorators.http import require_POST
|
||||||
|
|
||||||
from markdown import markdown
|
from markdown import markdown
|
||||||
from bookwyrm import forms, models
|
from bookwyrm import forms, models
|
||||||
|
from bookwyrm.models.report import DELETE_ITEM
|
||||||
from bookwyrm.utils import regex, sanitizer
|
from bookwyrm.utils import regex, sanitizer
|
||||||
from .helpers import handle_remote_webfinger, is_api_request
|
from .helpers import handle_remote_webfinger, is_api_request
|
||||||
from .helpers import load_date_in_user_tz_as_utc, redirect_to_referer
|
from .helpers import load_date_in_user_tz_as_utc, redirect_to_referer
|
||||||
|
@ -167,7 +168,7 @@ def format_hashtags(content, hashtags):
|
||||||
class DeleteStatus(View):
|
class DeleteStatus(View):
|
||||||
"""tombstone that bad boy"""
|
"""tombstone that bad boy"""
|
||||||
|
|
||||||
def post(self, request, status_id):
|
def post(self, request, status_id, report_id=None):
|
||||||
"""delete and tombstone a status"""
|
"""delete and tombstone a status"""
|
||||||
status = get_object_or_404(models.Status, id=status_id)
|
status = get_object_or_404(models.Status, id=status_id)
|
||||||
|
|
||||||
|
@ -176,7 +177,11 @@ class DeleteStatus(View):
|
||||||
|
|
||||||
# perform deletion
|
# perform deletion
|
||||||
status.delete()
|
status.delete()
|
||||||
return redirect("/")
|
# record deletion if it's related to a report
|
||||||
|
if report_id:
|
||||||
|
models.Report.record_action(report_id, DELETE_ITEM, request.user)
|
||||||
|
|
||||||
|
return redirect_to_referer(request, "/")
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
|
|
Loading…
Reference in a new issue