AJAX-ify the delete link on a toot

This commit is contained in:
Jason McBrayer 2018-09-05 21:29:12 -04:00
parent 8c847f0452
commit 8ab83275f6
2 changed files with 7 additions and 2 deletions

View File

@ -124,7 +124,12 @@
<a class="level-item" href="{% url "redraft" toot.id %}">
redraft
</a>
<a class="level-item" href="{% url "delete" toot.id %}">
<a class="level-item" href="{% url "delete" toot.id %}"
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">
delete
</a>
{% endif %}

View File

@ -614,7 +614,7 @@ def boost(request, id):
def delete(request, id):
account, mastodon = get_usercontext(request)
toot = mastodon.status(id)
if request.method == 'POST':
if request.method == 'POST' or request.method == 'DELETE':
if toot.account.acct != request.session['user'].acct:
return redirect('home')
if not request.POST.get('cancel', None):