Make AJAX version of toot deletion work better

This commit is contained in:
Jason McBrayer 2018-09-06 11:45:28 -04:00
parent 09909f3270
commit 6e087eb45f
2 changed files with 7 additions and 5 deletions

View File

@ -5,9 +5,9 @@
{% load static %}
{% if active %}
<article class="media box active-context">
<article id="toot-{{toot.id}}" class="media box active-context">
{% else %}
<article class="media box">
<article id="toot-{{toot.id}}" class="media box">
{% endif %}
<figure class="media-left">
@ -132,8 +132,8 @@
ic-delete-from="{% url "delete" toot.id %}"
ic-indicator="#toot-spinner-{{toot.id}}"
ic-confirm="Really delete that toot?"
ic-target="#main"
ic-select-from-response="#main">
ic-success-action="fadeOut;remove"
ic-action-target="#toot-{{ toot.id }}">
delete
</a>
{% endif %}

View File

@ -619,7 +619,9 @@ def delete(request, id):
return redirect('home')
if not request.POST.get('cancel', None):
mastodon.status_delete(id)
return redirect(home)
if request.POST.get('ic-request') or request.DELETE.get('ic-request'):
return HttpResponse("")
return redirect(home)
else:
return render(request, 'main/delete.html',
{"toot": toot,