Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
get_stream: Rename `include_all_active` to `include_all`.
Shubham Padiace031c4b5273
diff --git a/api_docs/changelog.md b/api_docs/changelog.mdindex 78b8697fc05..1c76a040244 100644--- a/api_docs/changelog.md+++ b/api_docs/changelog.md@@ -25,6 +25,9 @@ format used by the Zulip server that they are interacting with.* [`GET /streams`](/api/get-streams): The new parameter`include_can_access_content`, if set to True, returns all thechannels that the user making the request has content access to.+* [`GET /streams`](/api/get-streams): Rename `include_all_active` to+ `include_all` since the separate `exclude_archived` parameter is what+ controls whether to include archived channels.**Feature level 355**diff --git a/zerver/actions/users.py b/zerver/actions/users.pyindex aba110f1a6a..1cd10d55592 100644--- a/zerver/actions/users.py+++ b/zerver/actions/users.py@@ -549,7 +549,7 @@ def send_stream_events_for_role_update() -> None:current_accessible_streams = get_streams_for_user(user_profile,- include_all_active=user_profile.is_realm_admin,+ include_all=user_profile.is_realm_admin,include_web_public=True,)@@ -621,7 +621,7 @@ def do_change_user_role(previously_accessible_streams = get_streams_for_user(user_profile,include_web_public=True,- include_all_active=user_profile.is_realm_admin,+ include_all=user_profile.is_realm_admin,)user_profile.role = valuediff --git a/zerver/lib/events.py b/zerver/lib/events.pyindex c83b2b5c078..2819c505e76 100644--- a/zerver/lib/events.py+++ b/zerver/lib/events.py@@ -721,7 +721,7 @@ def fetch_initial_state_data(state["streams"] = do_get_streams(user_profile,include_web_public=True,- include_all_active=user_profile.is_realm_admin,+ include_all=user_profile.is_realm_admin,)else:# TODO: This line isn't used by the web app because itdiff --git a/zerver/lib/streams.py b/zerver/lib/streams.pyindex 8ee0ba433af..9877dbbe677 100644--- a/zerver/lib/streams.py+++ b/zerver/lib/streams.py@@ -1441,11 +1441,11 @@ def get_streams_for_user(include_web_public: bool = False,include_subscribed: bool = True,exclude_archived: bool = True,- include_all_active: bool = False,+ include_all: bool = False,include_owner_subscribed: bool = False,include_can_access_content: bool = False,) -> list[Stream]:- if include_all_active and not user_profile.is_realm_admin:+ if include_all and not user_profile.is_realm_admin:raise JsonableError(_("User not authorized for this query"))include_public = include_public and user_profile.can_access_public_streams()@@ -1458,7 +1458,7 @@ def get_streams_for_user(if exclude_archived:query = query.filter(deactivated=False)- if include_all_active:+ if include_all:streams = query.only(*Stream.API_FIELDS, "can_send_message_group", "can_send_message_group__named_user_group")@@ -1614,7 +1614,7 @@ def do_get_streams(include_web_public: bool = False,include_subscribed: bool = True,exclude_archived: bool = True,- include_all_active: bool = False,+ include_all: bool = False,include_default: bool = False,include_owner_subscribed: bool = False,include_can_access_content: bool = False,@@ -1627,7 +1627,7 @@ def do_get_streams(include_web_public,include_subscribed,exclude_archived,- include_all_active,+ include_all,include_owner_subscribed,include_can_access_content,)diff --git a/zerver/openapi/python_examples.py b/zerver/openapi/python_examples.pyindex 712b1c585fe..f5e53258ecf 100644--- a/zerver/openapi/python_examples.py+++ b/zerver/openapi/python_examples.py@@ -827,7 +827,7 @@ def get_user_groups(client: Client) -> int:def test_user_not_authorized_error(nonadmin_client: Client) -> None:- result = nonadmin_client.get_streams(include_all_active=True)+ result = nonadmin_client.get_streams(include_all=True)assert_error_response(result)validate_against_openapi_schema(result, "/rest-error-handling", "post", "400")diff --git a/zerver/openapi/zulip.yaml b/zerver/openapi/zulip.yamlindex 9c2ace5eeff..ce57ebd2025 100644--- a/zerver/openapi/zulip.yaml+++ b/zerver/openapi/zulip.yaml@@ -20340,8 +20340,31 @@ paths:- name: include_all_activein: querydescription: |- Include all active channels. The user must have administrative privileges- to use this parameter.+ Deprecated parameter to include all channels. The user must+ have administrative privileges to use this parameter.++ **Changes**: Deprecated in Zulip 10.0 (feature level+ 356). Clients interacting with newer servers should use+ the equivalent `include_all` parameter, which does not+ incorrectly hint that this parameter, and not+ `exclude_archived`, controls whether archived channels+ appear in the response.+ schema:+ type: boolean+ default: false+ deprecated: true+ example: true+ - name: include_all+ in: query+ description: |+ Include all channels that the user has metadata access to.++ For organization administrators, this will be all channels+ in the organization, since organization administrators+ implicitly have metadata access to all channels.++ **Changes**: New in Zulip 10.0 (feature level 356). On older+ versions, use `include_all_active`, which this replaces.schema:type: booleandefault: false@@ -20525,7 +20548,7 @@ paths:}description: |An example JSON response for when the user is not authorized to use the- `include_all_active` parameter (i.e. because they are not an organization+ `include_all` parameter (i.e. because they are not an organizationadministrator):/streams/{stream_id}:get:diff --git a/zerver/tests/test_subs.py b/zerver/tests/test_subs.pyindex c221c7b7e9e..5c9a6ddf254 100644--- a/zerver/tests/test_subs.py+++ b/zerver/tests/test_subs.py@@ -246,7 +246,7 @@ class TestMiscStuff(ZulipTestCase):user_profile=user_profile,include_public=False,include_subscribed=False,- include_all_active=False,+ include_all=False,include_default=False,)self.assertEqual(streams, [])@@ -3219,7 +3219,7 @@ class StreamAdminTest(ZulipTestCase):# It shows up with `exclude_archived` parameter set to false.result = self.client_get(- "/json/streams", {"exclude_archived": "false", "include_all_active": "true"}+ "/json/streams", {"exclude_archived": "false", "include_all": "true"})streams = [s["name"] for s in self.assert_json_success(result)["streams"]]self.assertIn(deactivated_stream_name, streams)@@ -6883,9 +6883,10 @@ class GetStreamsTest(ZulipTestCase):def test_all_active_streams_api(self) -> None:url = "/api/v1/streams"- data = {"include_all_active": "true"}+ data = {"include_all": "true"}+ backward_compatible_data = {"include_all_active": "true"}- # Check non-superuser can't use include_all_active+ # Check non-superuser can't use include_allnormal_user = self.example_user("cordelia")result = self.api_get(normal_user, url, data)self.assertEqual(result.status_code, 400)@@ -6897,6 +6898,11 @@ class GetStreamsTest(ZulipTestCase):result = self.api_get(admin_user, url, data)json = self.assert_json_success(result)+ backward_compatible_result = self.api_get(admin_user, url, backward_compatible_data)+ json_for_backward_compatible_request = self.assert_json_success(backward_compatible_result)++ self.assertEqual(json, json_for_backward_compatible_request)+self.assertIn("streams", json)self.assertIsInstance(json["streams"], list)diff --git a/zerver/views/streams.py b/zerver/views/streams.pyindex a94da31aa5b..0f3663e8a16 100644--- a/zerver/views/streams.py+++ b/zerver/views/streams.py@@ -925,18 +925,21 @@ def get_streams_backend(include_web_public: Json[bool] = False,include_subscribed: Json[bool] = True,exclude_archived: Json[bool] = True,+ include_all: Json[bool] = False,include_all_active: Json[bool] = False,include_default: Json[bool] = False,include_owner_subscribed: Json[bool] = False,include_can_access_content: Json[bool] = False,) -> HttpResponse:+ if include_all_active is True:+ include_all = Truestreams = do_get_streams(user_profile,include_public=include_public,include_web_public=include_web_public,include_subscribed=include_subscribed,exclude_archived=exclude_archived,- include_all_active=include_all_active,+ include_all=include_all,include_default=include_default,include_owner_subscribed=include_owner_subscribed,include_can_access_content=include_can_access_content,