Remove get_stores_for_object abstract method

The implementations still have and use this, we've just removed this
concept from the RedisStore abstraction, which simplifies things
somewhat.
This commit is contained in:
Wesley Aptekar-Cassels 2023-04-05 20:57:39 -04:00
parent 68c6a9e748
commit 78607a0c3e
4 changed files with 3 additions and 4 deletions

View file

@ -150,6 +150,7 @@ class ActivityStream(RedisStore):
return [user.id for user in self._get_audience(status)]
def get_stores_for_object(self, obj):
"""the stores that an object belongs in"""
return [self.stream_id(user_id) for user_id in self.get_audience(obj)]
def get_statuses_for_user(self, user): # pylint: disable=no-self-use

View file

@ -97,6 +97,7 @@ class ListsStream(RedisStore):
return audience.distinct()
def get_stores_for_object(self, obj):
"""the stores that an object belongs in"""
return [self.stream_id(u) for u in self.get_audience(obj)]
def get_lists_for_user(self, user): # pylint: disable=no-self-use

View file

@ -82,10 +82,6 @@ class RedisStore(ABC):
def get_objects_for_store(self, store):
"""a queryset of what should go in a store, used for populating it"""
@abstractmethod
def get_stores_for_object(self, obj):
"""the stores that an object belongs in"""
@abstractmethod
def get_rank(self, obj):
"""how to rank an object"""

View file

@ -49,6 +49,7 @@ class SuggestedUsers(RedisStore):
)
def get_stores_for_object(self, obj):
"""the stores that an object belongs in"""
return [self.store_id(u) for u in self.get_users_for_object(obj)]
def get_users_for_object(self, obj): # pylint: disable=no-self-use