mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-12-20 15:17:06 +00:00
Fixes boosts removing statuses from feeds
This commit is contained in:
parent
e76163ffae
commit
f284eebece
2 changed files with 5 additions and 3 deletions
|
@ -273,9 +273,10 @@ def add_status_on_create(sender, instance, created, *args, **kwargs):
|
||||||
created_date__lt=instance.created_date,
|
created_date__lt=instance.created_date,
|
||||||
)
|
)
|
||||||
for stream in streams.values():
|
for stream in streams.values():
|
||||||
stream.remove_object_from_related_stores(boosted)
|
audience = streams.get_stores_for_object(instance)
|
||||||
|
stream.remove_object_from_related_stores(boosted, stores=audience)
|
||||||
for status in old_versions:
|
for status in old_versions:
|
||||||
stream.remove_object_from_related_stores(status)
|
stream.remove_object_from_related_stores(status, stores=audience)
|
||||||
|
|
||||||
|
|
||||||
@receiver(signals.post_delete, sender=models.Boost)
|
@receiver(signals.post_delete, sender=models.Boost)
|
||||||
|
|
|
@ -33,8 +33,9 @@ class RedisStore(ABC):
|
||||||
# and go!
|
# and go!
|
||||||
return pipeline.execute()
|
return pipeline.execute()
|
||||||
|
|
||||||
def remove_object_from_related_stores(self, obj):
|
def remove_object_from_related_stores(self, obj, stores=None):
|
||||||
"""remove an object from all stores"""
|
"""remove an object from all stores"""
|
||||||
|
stores = stores or self.get_stores_for_object(obj)
|
||||||
pipeline = r.pipeline()
|
pipeline = r.pipeline()
|
||||||
for store in self.get_stores_for_object(obj):
|
for store in self.get_stores_for_object(obj):
|
||||||
pipeline.zrem(store, -1, obj.id)
|
pipeline.zrem(store, -1, obj.id)
|
||||||
|
|
Loading…
Reference in a new issue