diff --git a/fedireads/outgoing.py b/fedireads/outgoing.py index f4cb25a4..dc60b2c0 100644 --- a/fedireads/outgoing.py +++ b/fedireads/outgoing.py @@ -293,16 +293,15 @@ def handle_unfavorite(user, status): 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. + if models.Boost.objects.filter( + boosted_status=status, user=user).exists(): + # you already boosted that. return + boost = models.Boost.objects.create( + boosted_status=status, + user=user, + ) + boost.save() boost_activity = activitypub.get_boost(boost) recipients = get_recipients(user, 'public')