mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-12-24 17:10:31 +00:00
create notification for local favs/boosts
This commit is contained in:
parent
aa170d0d6c
commit
4710e65269
2 changed files with 17 additions and 5 deletions
|
@ -269,11 +269,10 @@ def handle_favorite(activity):
|
||||||
@app.task
|
@app.task
|
||||||
def handle_unfavorite(activity):
|
def handle_unfavorite(activity):
|
||||||
''' approval of your good good post '''
|
''' approval of your good good post '''
|
||||||
try:
|
like = models.Favorite.objects.filter(
|
||||||
like = models.Favorite.objects.filter(
|
remote_id=activity['object']['id']
|
||||||
remote_id=activity['object']['id']
|
).first()
|
||||||
).first()
|
if not like:
|
||||||
except models.Favorite.DoesNotExist:
|
|
||||||
return
|
return
|
||||||
like.delete()
|
like.delete()
|
||||||
|
|
||||||
|
|
|
@ -286,6 +286,12 @@ def handle_favorite(user, status):
|
||||||
fav_activity = favorite.to_activity()
|
fav_activity = favorite.to_activity()
|
||||||
broadcast(
|
broadcast(
|
||||||
user, fav_activity, privacy='direct', direct_recipients=[status.user])
|
user, fav_activity, privacy='direct', direct_recipients=[status.user])
|
||||||
|
create_notification(
|
||||||
|
status.user,
|
||||||
|
'FAVORITE',
|
||||||
|
related_user=user,
|
||||||
|
related_status=status
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def handle_unfavorite(user, status):
|
def handle_unfavorite(user, status):
|
||||||
|
@ -319,6 +325,13 @@ def handle_boost(user, status):
|
||||||
boost_activity = boost.to_activity()
|
boost_activity = boost.to_activity()
|
||||||
broadcast(user, boost_activity)
|
broadcast(user, boost_activity)
|
||||||
|
|
||||||
|
create_notification(
|
||||||
|
status.user,
|
||||||
|
'BOOST',
|
||||||
|
related_user=user,
|
||||||
|
related_status=status
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def handle_unboost(user, status):
|
def handle_unboost(user, status):
|
||||||
''' a user regrets boosting a status '''
|
''' a user regrets boosting a status '''
|
||||||
|
|
Loading…
Reference in a new issue