mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-29 04:51:11 +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>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<div class="column is-two-thirds">
|
<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 %}
|
{% if not draft %}
|
||||||
{% include 'snippets/create_status.html' %}
|
{% include 'snippets/create_status.html' %}
|
||||||
{% else %}
|
{% else %}
|
||||||
|
@ -26,6 +30,5 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{ form.ap_p }}
|
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -27,7 +27,8 @@
|
||||||
{% trans "Delete status" %}
|
{% trans "Delete status" %}
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
|
{% elif no_interact %}
|
||||||
|
{# nothing here #}
|
||||||
{% elif request.user.is_authenticated %}
|
{% elif request.user.is_authenticated %}
|
||||||
<div class="field has-addons">
|
<div class="field has-addons">
|
||||||
<div class="control">
|
<div class="control">
|
||||||
|
|
|
@ -104,16 +104,20 @@ class DeleteAndRedraft(View):
|
||||||
status = get_object_or_404(
|
status = get_object_or_404(
|
||||||
models.Status.objects.select_subclasses(), id=status_id
|
models.Status.objects.select_subclasses(), id=status_id
|
||||||
)
|
)
|
||||||
if isinstance(status, (models.GeneratedNote, models.Rating)):
|
if isinstance(status, (models.GeneratedNote, models.ReviewRating)):
|
||||||
return HttpResponseBadRequest()
|
return HttpResponseBadRequest()
|
||||||
|
|
||||||
# don't let people redraft other people's statuses
|
# don't let people redraft other people's statuses
|
||||||
if status.user != request.user:
|
if status.user != request.user:
|
||||||
return HttpResponseBadRequest()
|
return HttpResponseBadRequest()
|
||||||
|
|
||||||
|
status_type = status.status_type.lower()
|
||||||
|
if status.reply_parent:
|
||||||
|
status_type = 'reply'
|
||||||
|
|
||||||
data = {
|
data = {
|
||||||
"draft": status,
|
"draft": status,
|
||||||
"type": status.status_type.lower(),
|
"type": status_type,
|
||||||
}
|
}
|
||||||
if hasattr(status, "book"):
|
if hasattr(status, "book"):
|
||||||
data["book"] = status.book
|
data["book"] = status.book
|
||||||
|
|
Loading…
Reference in a new issue