mirror of https://github.com/zulip/zulip.git
Don't filter invite-only streams for mit.edu superuser.
It's likely we'll eventually want to split this into 2 API queries, but most of the code in get_public_streams_backend is specialized for the performance requirements of the mit.edu mirroring anyway. (imported from commit 47ac6586b59467fd64992c573b6e36885167dcc5)
This commit is contained in:
parent
f446b72233
commit
3ffc3bc7f6
|
@ -1304,10 +1304,15 @@ def get_public_streams_backend(request, user_profile):
|
|||
subs_filter = Subscription.objects.filter(active=True).values('recipient_id')
|
||||
stream_ids = Recipient.objects.filter(
|
||||
type=Recipient.STREAM, id__in=subs_filter).values('type_id')
|
||||
streams = sorted({"name": stream.name} for stream in
|
||||
Stream.objects.filter(id__in = stream_ids,
|
||||
realm=user_profile.realm,
|
||||
invite_only=False))
|
||||
query = Stream.objects.filter(id__in = stream_ids, realm=user_profile.realm)
|
||||
if not (user_profile.realm.domain == "mit.edu" and is_super_user_api(request)):
|
||||
# We don't apply the `invite_only=False` filter when answering
|
||||
# the mit.edu API superuser, because the list of streams is
|
||||
# used as the list of all Zephyr classes to mirror, and we
|
||||
# want to include invite-only streams (aka zcrypted classes) in that
|
||||
query.filter(invite_only=False)
|
||||
|
||||
streams = sorted({"name": stream.name} for stream in query)
|
||||
return json_success({"streams": streams})
|
||||
|
||||
@authenticated_api_view
|
||||
|
|
Loading…
Reference in New Issue