Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
register: Include archived channels in "streams" field.
Sahil Batraae579aa25a63
diff --git a/api_docs/unmerged.d/ZF-5769ba b/api_docs/unmerged.d/ZF-5769banew file mode 100644index 00000000000..35f40e3f5eb--- /dev/null+++ b/api_docs/unmerged.d/ZF-5769ba@@ -0,0 +1,3 @@+* [`POST /register`](/api/register-queue): The `streams` data+ structure now includes archived channels for clients that+ declared the `archived_channels` client capability.\ No newline at end of filediff --git a/zerver/lib/events.py b/zerver/lib/events.pyindex 90446612ba8..3a0a12f1fca 100644--- a/zerver/lib/events.py+++ b/zerver/lib/events.py@@ -784,6 +784,7 @@ def fetch_initial_state_data(state["streams"] = do_get_streams(user_profile,include_web_public=True,+ exclude_archived=not archived_channels,include_all=True,anonymous_group_membership=anonymous_group_membership_data_dict,)@@ -1307,11 +1308,8 @@ def apply_event(if event["op"] == "delete":deleted_stream_ids = {stream["stream_id"] for stream in event["streams"]}- if "streams" in state:- state["streams"] = [- s for s in state["streams"] if s["stream_id"] not in deleted_stream_ids- ]+ updated_first_message_ids: dict[int, int] = dict()if archived_channels:for stream in state["subscriptions"]:if stream["stream_id"] in deleted_stream_ids:@@ -1321,17 +1319,32 @@ def apply_event(if stream["stream_id"] in deleted_stream_ids:stream["is_archived"] = Trueif stream["first_message_id"] is None:- stream["first_message_id"] = Stream.objects.get(+ new_first_message_id = Stream.objects.get(id=stream["stream_id"]).first_message_id+ assert new_first_message_id is not None+ stream["first_message_id"] = new_first_message_id+ updated_first_message_ids[stream["stream_id"]] = new_first_message_idfor stream in state["never_subscribed"]:if stream["stream_id"] in deleted_stream_ids:stream["is_archived"] = Trueif stream["first_message_id"] is None:- stream["first_message_id"] = Stream.objects.get(+ new_first_message_id = Stream.objects.get(id=stream["stream_id"]).first_message_id+ assert new_first_message_id is not None+ stream["first_message_id"] = new_first_message_id+ updated_first_message_ids[stream["stream_id"]] = new_first_message_id++ if "streams" in state:+ for stream in state["streams"]:+ if stream["stream_id"] in deleted_stream_ids:+ stream["is_archived"] = True+ if stream["stream_id"] in updated_first_message_ids:+ stream["first_message_id"] = updated_first_message_ids[+ stream["stream_id"]+ ]else:state["subscriptions"] = [stream@@ -1351,6 +1364,11 @@ def apply_event(if stream["stream_id"] not in deleted_stream_ids]+ if "streams" in state:+ state["streams"] = [+ s for s in state["streams"] if s["stream_id"] not in deleted_stream_ids+ ]+if event["op"] == "update":# For legacy reasons, we call stream data 'subscriptions' in# the state var here, for the benefit of the JS code.diff --git a/zerver/openapi/zulip.yaml b/zerver/openapi/zulip.yamlindex 724b08a7390..e3d45f601b0 100644--- a/zerver/openapi/zulip.yaml+++ b/zerver/openapi/zulip.yaml@@ -15743,8 +15743,12 @@ paths:For organization administrators, this will include all private channelsin the organization.- **Changes**: As of Zulip 8.0 (feature level 205), this will include all- web-public channels in the organization as well.+ **Changes**: Before Zulip 11.0 (feature level ZF-5769ba), archived channels+ did not appear in this list, even if the `archived_channels` [client+ capability][client-capabilities] was declared by the client.++ As of Zulip 8.0 (feature level 205), this will include all web-public+ channels in the organization as well.realm_default_streams:type: arrayitems: