mirror of
https://github.com/jfmcbrayer/brutaldon
synced 2024-12-23 05:43:41 +01:00
Correctly cancel out of (un)boosting or faving toots
This commit is contained in:
parent
804a4dfd67
commit
421d27ef07
@ -199,10 +199,11 @@ def fav(request, id):
|
||||
mastodon = get_mastodon(request)
|
||||
toot = mastodon.status(id)
|
||||
if request.method == 'POST':
|
||||
if toot.favourited:
|
||||
mastodon.status_unfavourite(id)
|
||||
else:
|
||||
mastodon.status_favourite(id)
|
||||
if not request.POST['cancel']:
|
||||
if toot.favourited:
|
||||
mastodon.status_unfavourite(id)
|
||||
else:
|
||||
mastodon.status_favourite(id)
|
||||
return redirect(thread, id)
|
||||
else:
|
||||
return render(request, 'main/fav.html', {"toot": toot})
|
||||
@ -211,10 +212,11 @@ def boost(request, id):
|
||||
mastodon = get_mastodon(request)
|
||||
toot = mastodon.status(id)
|
||||
if request.method == 'POST':
|
||||
if toot.reblogged:
|
||||
mastodon.status_unreblog(id)
|
||||
else:
|
||||
mastodon.status_reblog(id)
|
||||
if not request.POST['cancel']:
|
||||
if toot.reblogged:
|
||||
mastodon.status_unreblog(id)
|
||||
else:
|
||||
mastodon.status_reblog(id)
|
||||
return redirect(thread, id)
|
||||
else:
|
||||
return render(request, 'main/boost.html', {"toot": toot})
|
||||
|
Loading…
Reference in New Issue
Block a user