diff --git a/bookwyrm/activitystreams.py b/bookwyrm/activitystreams.py index 1feb495b7..f843641f5 100644 --- a/bookwyrm/activitystreams.py +++ b/bookwyrm/activitystreams.py @@ -480,12 +480,14 @@ def handle_boost_task(boost_id): instance = models.Status.objects.get(id=boost_id) boosted = instance.boost.boosted_status + # previous boosts of this status old_versions = models.Boost.objects.filter( boosted_status__id=boosted.id, created_date__lt=instance.created_date, ) for stream in streams.values(): + # people who should see the boost (not people who see the original status) audience = stream.get_stores_for_object(instance) stream.remove_object_from_related_stores(boosted, stores=audience) for status in old_versions: diff --git a/bookwyrm/redis_store.py b/bookwyrm/redis_store.py index 521e73b26..78f373a2e 100644 --- a/bookwyrm/redis_store.py +++ b/bookwyrm/redis_store.py @@ -35,7 +35,7 @@ class RedisStore(ABC): def remove_object_from_related_stores(self, obj, stores=None): """remove an object from all stores""" - stores = stores or self.get_stores_for_object(obj) + stores = self.get_stores_for_object(obj) if stores is None else stores pipeline = r.pipeline() for store in stores: pipeline.zrem(store, -1, obj.id) diff --git a/bookwyrm/tests/activitystreams/test_tasks.py b/bookwyrm/tests/activitystreams/test_tasks.py index 1002e4a8a..887047830 100644 --- a/bookwyrm/tests/activitystreams/test_tasks.py +++ b/bookwyrm/tests/activitystreams/test_tasks.py @@ -125,7 +125,7 @@ class Activitystreams(TestCase): @patch("bookwyrm.activitystreams.BooksStream.remove_object_from_related_stores") @patch("bookwyrm.models.activitypub_mixin.broadcast_task.delay") def test_boost_to_another_timeline(self, *_): - """add a boost and deduplicate the boosted status on the timeline""" + """boost from a non-follower doesn't remove original status from feed""" status = models.Status.objects.create(user=self.local_user, content="hi") with patch("bookwyrm.activitystreams.handle_boost_task.delay"): boost = models.Boost.objects.create( @@ -138,6 +138,7 @@ class Activitystreams(TestCase): activitystreams.handle_boost_task(boost.id) self.assertTrue(mock.called) + self.assertEqual(mock.call_count, 1) call_args = mock.call_args self.assertEqual(call_args[0][0], status) self.assertEqual(