mirror of
https://github.com/zulip/zulip.git
synced 2025-10-26 09:34:02 +00:00
streams: Remove duplicates of get_web_public_streams_queryset.
This is a somewhat subtle function, that deserves a few comments explaining subtle details of its logic, and there's no good reason to have multiple copies of that logic that are slightly inconsistent. Because the main changes here are just checking for invariant failures, the behavioral change here should be limited to ensuring deactivated streams are not considered available even if they were tagged as web public streams before deactivation.
This commit is contained in:
@@ -399,15 +399,20 @@ def get_public_streams_queryset(realm: Realm) -> "QuerySet[Stream]":
|
||||
|
||||
|
||||
def get_web_public_streams_queryset(realm: Realm) -> "QuerySet[Stream]":
|
||||
# In theory, is_web_public=True implies invite_only=False and
|
||||
# history_public_to_subscribers=True, but it's safer to include
|
||||
# this in the query.
|
||||
# This should match the include_web_public code path in do_get_streams.
|
||||
return Stream.objects.filter(
|
||||
realm=realm,
|
||||
is_web_public=True,
|
||||
# In theory, nothing conflicts with allowing web-public access
|
||||
# to deactivated streams. However, we should offer a way to
|
||||
# review archived streams and adjust their settings before
|
||||
# allowing that configuration to exist.
|
||||
deactivated=False,
|
||||
# In theory, is_web_public=True implies invite_only=False and
|
||||
# history_public_to_subscribers=True, but it's safer to include
|
||||
# these in the query.
|
||||
invite_only=False,
|
||||
history_public_to_subscribers=True,
|
||||
is_web_public=True,
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user