mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-26 03:21:05 +00:00
Outgoing unboost
This commit is contained in:
parent
e6d46878fb
commit
c58538539a
3 changed files with 20 additions and 0 deletions
|
@ -320,6 +320,16 @@ def handle_boost(user, status):
|
|||
broadcast(user, boost_activity)
|
||||
|
||||
|
||||
def handle_unboost(user, status):
|
||||
''' a user regrets boosting a status '''
|
||||
boost = models.Boost.objects.filter(
|
||||
boosted_status=status, user=user).first()
|
||||
activity = boost.to_undo_activity(user)
|
||||
|
||||
status_builder.delete_status(boost)
|
||||
broadcast(user, activity)
|
||||
|
||||
|
||||
def handle_update_book(user, book):
|
||||
''' broadcast the news about our book '''
|
||||
broadcast(user, book.to_update_activity(user))
|
||||
|
|
|
@ -116,6 +116,7 @@ urlpatterns = [
|
|||
re_path(r'^favorite/(?P<status_id>\d+)/?$', actions.favorite),
|
||||
re_path(r'^unfavorite/(?P<status_id>\d+)/?$', actions.unfavorite),
|
||||
re_path(r'^boost/(?P<status_id>\d+)/?$', actions.boost),
|
||||
re_path(r'^unboost/(?P<status_id>\d+)/?$', actions.boost),
|
||||
|
||||
re_path(r'^delete-status/?$', actions.delete_status),
|
||||
|
||||
|
|
|
@ -508,6 +508,7 @@ def unfavorite(request, status_id):
|
|||
outgoing.handle_unfavorite(request.user, status)
|
||||
return redirect(request.headers.get('Referer', '/'))
|
||||
|
||||
|
||||
@login_required
|
||||
def boost(request, status_id):
|
||||
''' boost a status '''
|
||||
|
@ -516,6 +517,14 @@ def boost(request, status_id):
|
|||
return redirect(request.headers.get('Referer', '/'))
|
||||
|
||||
|
||||
@login_required
|
||||
def unboost(request, status_id):
|
||||
''' boost a status '''
|
||||
status = models.Status.objects.get(id=status_id)
|
||||
outgoing.handle_unboost(request.user, status)
|
||||
return redirect(request.headers.get('Referer', '/'))
|
||||
|
||||
|
||||
@login_required
|
||||
def delete_status(request):
|
||||
''' delete and tombstone a status '''
|
||||
|
|
Loading…
Reference in a new issue