Removes unused stream code
This commit is contained in:
parent
3b46ce8501
commit
75f586c109
|
@ -156,25 +156,6 @@ class LocalStream(ActivityStream):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class FederatedStream(ActivityStream):
|
|
||||||
"""users you follow"""
|
|
||||||
|
|
||||||
key = "federated"
|
|
||||||
|
|
||||||
def get_audience(self, status):
|
|
||||||
# this stream wants no part in non-public statuses
|
|
||||||
if status.privacy != "public":
|
|
||||||
return []
|
|
||||||
return super().get_audience(status)
|
|
||||||
|
|
||||||
def get_statuses_for_user(self, user):
|
|
||||||
return privacy_filter(
|
|
||||||
user,
|
|
||||||
models.Status.objects.select_subclasses(),
|
|
||||||
privacy_levels=["public"],
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class BooksStream(ActivityStream):
|
class BooksStream(ActivityStream):
|
||||||
"""books on your shelves"""
|
"""books on your shelves"""
|
||||||
|
|
||||||
|
@ -201,7 +182,7 @@ class BooksStream(ActivityStream):
|
||||||
return audience.filter(shelfbook__book__parent_work=work).distinct()
|
return audience.filter(shelfbook__book__parent_work=work).distinct()
|
||||||
|
|
||||||
def get_statuses_for_user(self, user):
|
def get_statuses_for_user(self, user):
|
||||||
"""any public status that mentions their books"""
|
"""any public status that mentions the user's books"""
|
||||||
books = user.shelfbook_set.values_list(
|
books = user.shelfbook_set.values_list(
|
||||||
"book__parent_work__id", flat=True
|
"book__parent_work__id", flat=True
|
||||||
).distinct()
|
).distinct()
|
||||||
|
@ -219,13 +200,13 @@ class BooksStream(ActivityStream):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
# determine which streams are enabled in settings.py
|
||||||
available_streams = [s["key"] for s in STREAMS]
|
available_streams = [s["key"] for s in STREAMS]
|
||||||
streams = {
|
streams = {
|
||||||
k: v
|
k: v
|
||||||
for (k, v) in {
|
for (k, v) in {
|
||||||
"home": HomeStream(),
|
"home": HomeStream(),
|
||||||
"local": LocalStream(),
|
"local": LocalStream(),
|
||||||
"federated": FederatedStream(),
|
|
||||||
"books": BooksStream(),
|
"books": BooksStream(),
|
||||||
}.items()
|
}.items()
|
||||||
if k in available_streams
|
if k in available_streams
|
||||||
|
|
Loading…
Reference in New Issue