2
0
mirror of https://github.com/jfmcbrayer/brutaldon synced 2024-12-23 13:49:48 +01:00

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

View File

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