Merge branch 'main' into production

This commit is contained in:
Mouse Reeve 2020-11-07 19:15:27 -08:00
commit 29e5c67f83
2 changed files with 17 additions and 5 deletions

View file

@ -269,11 +269,10 @@ def handle_favorite(activity):
@app.task
def handle_unfavorite(activity):
''' approval of your good good post '''
try:
like = models.Favorite.objects.filter(
remote_id=activity['object']['id']
).first()
except models.Favorite.DoesNotExist:
like = models.Favorite.objects.filter(
remote_id=activity['object']['id']
).first()
if not like:
return
like.delete()

View file

@ -286,6 +286,12 @@ def handle_favorite(user, status):
fav_activity = favorite.to_activity()
broadcast(
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):
@ -319,6 +325,13 @@ def handle_boost(user, status):
boost_activity = boost.to_activity()
broadcast(user, boost_activity)
create_notification(
status.user,
'BOOST',
related_user=user,
related_status=status
)
def handle_unboost(user, status):
''' a user regrets boosting a status '''