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

View File

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