Boosts - handle url, store in database, send, notify.

This commit is contained in:
Adam Kelly
2020-03-30 15:13:32 +01:00
parent 84d7e7c394
commit 745ca7d4ff
11 changed files with 133 additions and 2 deletions

View File

@ -291,6 +291,22 @@ def handle_unfavorite(user, status):
recipients = get_recipients(user, 'direct', [status.user])
broadcast(user, fav_activity, recipients)
def handle_boost(user, status):
''' a user wishes to boost a status '''
try:
boost = models.Boost.objects.create(
boosted_status=status,
user=user,
)
boost.save()
except IntegrityError:
# you already boosted that
# TODO - doesn't work because unique constraint isn't enforcable.
return
boost_activity = activitypub.get_boost(boost)
recipients = get_recipients(user, 'public')
broadcast(user, boost_activity, recipients)
def handle_update_book(user, book):
''' broadcast the news about our book '''