mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-12-25 17:40:35 +00:00
Handles delete and redraft replies
This commit is contained in:
parent
936d68f0ed
commit
be8c3b7904
3 changed files with 12 additions and 4 deletions
|
@ -19,6 +19,10 @@
|
|||
</div>
|
||||
{% endif %}
|
||||
<div class="column is-two-thirds">
|
||||
{% if draft.reply_parent %}
|
||||
{% include 'snippets/status/status.html' with status=draft.reply_parent no_interact=True %}
|
||||
{% endif %}
|
||||
|
||||
{% if not draft %}
|
||||
{% include 'snippets/create_status.html' %}
|
||||
{% else %}
|
||||
|
@ -26,6 +30,5 @@
|
|||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{{ form.ap_p }}
|
||||
{% endwith %}
|
||||
{% endblock %}
|
||||
|
|
|
@ -27,7 +27,8 @@
|
|||
{% trans "Delete status" %}
|
||||
</button>
|
||||
</form>
|
||||
|
||||
{% elif no_interact %}
|
||||
{# nothing here #}
|
||||
{% elif request.user.is_authenticated %}
|
||||
<div class="field has-addons">
|
||||
<div class="control">
|
||||
|
|
|
@ -104,16 +104,20 @@ class DeleteAndRedraft(View):
|
|||
status = get_object_or_404(
|
||||
models.Status.objects.select_subclasses(), id=status_id
|
||||
)
|
||||
if isinstance(status, (models.GeneratedNote, models.Rating)):
|
||||
if isinstance(status, (models.GeneratedNote, models.ReviewRating)):
|
||||
return HttpResponseBadRequest()
|
||||
|
||||
# don't let people redraft other people's statuses
|
||||
if status.user != request.user:
|
||||
return HttpResponseBadRequest()
|
||||
|
||||
status_type = status.status_type.lower()
|
||||
if status.reply_parent:
|
||||
status_type = 'reply'
|
||||
|
||||
data = {
|
||||
"draft": status,
|
||||
"type": status.status_type.lower(),
|
||||
"type": status_type,
|
||||
}
|
||||
if hasattr(status, "book"):
|
||||
data["book"] = status.book
|
||||
|
|
Loading…
Reference in a new issue