Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
streams: Rename `can_remove_subscribers_group_id` parameter.
Ujjawal Modic8bcb422f51b
diff --git a/api_docs/changelog.md b/api_docs/changelog.mdindex 1b704a3e670..1e7086a4471 100644--- a/api_docs/changelog.md+++ b/api_docs/changelog.md@@ -20,6 +20,17 @@ format used by the Zulip server that they are interacting with.## Changes in Zulip 8.0+**Feature level 197**++* [`POST /users/me/subscriptions`](/api/subscribe),+ [`PATCH /streams/{stream_id}`](/api/update-stream),+ [`GET users/me/subscriptions`](/api/get-subscriptions),+ [`GET /streams`](/api/get-streams),+ [`POST /register`](/api/register-queue),+ [`GET /events`](/api/get-events): Renamed+ stream setting `can_remove_subscribers_group_id`+ to `can_remove_subscribers_group`.+**Feature level 196*** [`POST /realm/playgrounds`](/api/add-code-playground): `url_prefix` isdiff --git a/version.py b/version.pyindex 974b949e2a6..09f0cd958bd 100644--- a/version.py+++ b/version.py@@ -33,7 +33,7 @@ DESKTOP_WARNING_VERSION = "5.9.3"# Changes should be accompanied by documentation explaining what the# new level means in api_docs/changelog.md, as well as "**Changes**"# entries in the endpoint's documentation in `zulip.yaml`.-API_FEATURE_LEVEL = 196+API_FEATURE_LEVEL = 197# Bump the minor PROVISION_VERSION to indicate that folks should provision# only when going from an old version of the code to a newer version. Bumpdiff --git a/web/src/settings_org.js b/web/src/settings_org.jsindex 4559ab09c56..55fe5a5e425 100644--- a/web/src/settings_org.js+++ b/web/src/settings_org.js@@ -600,7 +600,7 @@ export function get_widget_for_dropdown_list_settings(property_name) {return signup_notifications_stream_widget;case "realm_default_code_block_language":return default_code_language_widget;- case "can_remove_subscribers_group_id":+ case "can_remove_subscribers_group":return stream_edit.can_remove_subscribers_group_widget;default:blueslip.error("No dropdown list widget for property", {property_name});@@ -641,7 +641,7 @@ export function discard_property_element_changes(elem, for_realm_default_settingcase "realm_notifications_stream_id":case "realm_signup_notifications_stream_id":case "realm_default_code_block_language":- case "can_remove_subscribers_group_id":+ case "can_remove_subscribers_group":set_dropdown_list_widget_setting_value(property_name, property_value);break;case "realm_default_language":@@ -957,7 +957,7 @@ export function check_property_changed(elem, for_realm_default_settings, sub) {case "realm_notifications_stream_id":case "realm_signup_notifications_stream_id":case "realm_default_code_block_language":- case "can_remove_subscribers_group_id":+ case "can_remove_subscribers_group":proposed_val = get_dropdown_list_widget_setting_value($elem, false);break;case "email_notifications_batching_period_seconds":diff --git a/web/src/stream_create.js b/web/src/stream_create.jsindex 0efdb64eabd..d025d569709 100644--- a/web/src/stream_create.js+++ b/web/src/stream_create.js@@ -259,7 +259,7 @@ function create_stream() {stream_settings_ui.new_stream_can_remove_subscribers_group_widget.value(),10,);- data.can_remove_subscribers_group_id = can_remove_subscribers_group_id;+ data.can_remove_subscribers_group = can_remove_subscribers_group_id;loading.make_indicator($("#stream_creating_indicator"), {text: $t({defaultMessage: "Creating stream..."}),diff --git a/web/src/stream_data.js b/web/src/stream_data.jsindex 0b6e2e72535..7fefa49fe55 100644--- a/web/src/stream_data.js+++ b/web/src/stream_data.js@@ -430,7 +430,7 @@ export function update_message_retention_setting(sub, message_retention_days) {}export function update_can_remove_subscribers_group_id(sub, can_remove_subscribers_group_id) {- sub.can_remove_subscribers_group_id = can_remove_subscribers_group_id;+ sub.can_remove_subscribers_group = can_remove_subscribers_group_id;}export function receives_notifications(stream_id, notification_name) {@@ -558,7 +558,7 @@ export function can_unsubscribe_others(sub) {}return user_groups.is_user_in_group(- sub.can_remove_subscribers_group_id,+ sub.can_remove_subscribers_group,people.my_current_user_id(),);}diff --git a/web/src/stream_edit.js b/web/src/stream_edit.jsindex 328f57c65a4..b260d8c215d 100644--- a/web/src/stream_edit.js+++ b/web/src/stream_edit.js@@ -210,13 +210,13 @@ export function show_settings_for(node) {});const opts = {- widget_name: "can_remove_subscribers_group_id",+ widget_name: "can_remove_subscribers_group",data: user_groups.get_realm_user_groups_for_dropdown_list_widget("can_remove_subscribers_group",),default_text: $t({defaultMessage: "No user groups"}),include_current_item: false,- value: sub.can_remove_subscribers_group_id,+ value: sub.can_remove_subscribers_group,on_update() {settings_org.save_discard_widget_status_handler($("#stream_permission_settings"),diff --git a/web/src/stream_events.js b/web/src/stream_events.jsindex 773432086ee..91aca7522d1 100644--- a/web/src/stream_events.js+++ b/web/src/stream_events.js@@ -93,7 +93,7 @@ export function update_property(stream_id, property, value, other_values) {case "message_retention_days":stream_settings_ui.update_message_retention_setting(sub, value);break;- case "can_remove_subscribers_group_id":+ case "can_remove_subscribers_group":stream_settings_ui.update_can_remove_subscribers_group_id(sub, value);break;default:diff --git a/web/src/stream_settings_ui.js b/web/src/stream_settings_ui.jsindex a4cebb09b79..3def45dbf42 100644--- a/web/src/stream_settings_ui.js+++ b/web/src/stream_settings_ui.js@@ -247,7 +247,7 @@ export function update_message_retention_setting(sub, new_value) {export function update_can_remove_subscribers_group_id(sub, new_value) {stream_data.update_can_remove_subscribers_group_id(sub, new_value);- stream_ui_updates.update_setting_element(sub, "can_remove_subscribers_group_id");+ stream_ui_updates.update_setting_element(sub, "can_remove_subscribers_group");stream_edit_subscribers.rerender_subscribers_list(sub);}@@ -665,7 +665,7 @@ export function setup_page(callback) {$("#streams_overlay_container").empty();const opts = {- widget_name: "new_stream_can_remove_subscribers_group_id",+ widget_name: "new_stream_can_remove_subscribers_group",data: user_groups.get_realm_user_groups_for_dropdown_list_widget("can_remove_subscribers_group",),diff --git a/web/templates/stream_settings/stream_creation_form.hbs b/web/templates/stream_settings/stream_creation_form.hbsindex 9409f777e04..0ae3e2b1e20 100644--- a/web/templates/stream_settings/stream_creation_form.hbs+++ b/web/templates/stream_settings/stream_creation_form.hbs@@ -32,7 +32,7 @@{{> stream_typesstream_post_policy=stream_post_policy_values.everyone.codeis_stream_edit=false- can_remove_subscribers_setting_widget_name="new_stream_can_remove_subscribers_group_id" }}+ can_remove_subscribers_setting_widget_name="new_stream_can_remove_subscribers_group" }}</div></section><section class="block">diff --git a/web/templates/stream_settings/stream_settings.hbs b/web/templates/stream_settings/stream_settings.hbsindex 924038b9066..84c9f557b62 100644--- a/web/templates/stream_settings/stream_settings.hbs+++ b/web/templates/stream_settings/stream_settings.hbs@@ -61,7 +61,7 @@is_business_type_org=../is_business_type_orgorg_level_message_retention_setting=../org_level_message_retention_settingis_stream_edit=true- can_remove_subscribers_setting_widget_name="can_remove_subscribers_group_id" }}+ can_remove_subscribers_setting_widget_name="can_remove_subscribers_group" }}</div>{{/with}}<div class="stream-email-box" {{#unless sub.email_address}}style="display: none;"{{/unless}}>diff --git a/web/tests/lib/events.js b/web/tests/lib/events.jsindex a7e03c5a69e..7d45c4f193c 100644--- a/web/tests/lib/events.js+++ b/web/tests/lib/events.js@@ -50,7 +50,7 @@ exports.test_streams = {is_web_public: false,message_retention_days: null,stream_post_policy: 1,- can_remove_subscribers_group_id: 2,+ can_remove_subscribers_group: 2,},test: {name: "test",@@ -65,7 +65,7 @@ exports.test_streams = {is_announcement_only: false,message_retention_days: null,stream_post_policy: 1,- can_remove_subscribers_group_id: 2,+ can_remove_subscribers_group: 2,},};diff --git a/web/tests/stream_data.test.js b/web/tests/stream_data.test.jsindex af1dd98a1c8..a2904578748 100644--- a/web/tests/stream_data.test.js+++ b/web/tests/stream_data.test.js@@ -286,7 +286,7 @@ test("admin_options", () => {stream_id: 1,is_muted: true,invite_only: false,- can_remove_subscribers_group_id: admins_group.id,+ can_remove_subscribers_group: admins_group.id,};stream_data.add_sub(sub);return sub;@@ -339,7 +339,7 @@ test("stream_settings", () => {color: "cinnamon",subscribed: true,invite_only: false,- can_remove_subscribers_group_id: admins_group.id,+ can_remove_subscribers_group: admins_group.id,};const blue = {@@ -348,7 +348,7 @@ test("stream_settings", () => {color: "blue",subscribed: false,invite_only: false,- can_remove_subscribers_group_id: admins_group.id,+ can_remove_subscribers_group: admins_group.id,};const amber = {@@ -360,7 +360,7 @@ test("stream_settings", () => {history_public_to_subscribers: true,stream_post_policy: stream_data.stream_post_policy_values.admins.code,message_retention_days: 10,- can_remove_subscribers_group_id: admins_group.id,+ can_remove_subscribers_group: admins_group.id,};stream_data.add_sub(cinnamon);stream_data.add_sub(amber);@@ -398,7 +398,7 @@ test("stream_settings", () => {assert.equal(sub.history_public_to_subscribers, false);assert.equal(sub.stream_post_policy, stream_data.stream_post_policy_values.everyone.code);assert.equal(sub.message_retention_days, -1);- assert.equal(sub.can_remove_subscribers_group_id, moderators_group.id);+ assert.equal(sub.can_remove_subscribers_group, moderators_group.id);// For guest user only retrieve subscribed streamssub_rows = stream_settings_data.get_updated_unsorted_subs();@@ -970,7 +970,7 @@ test("can_unsubscribe_others", () => {subscribed: true,color: "red",stream_id: 1,- can_remove_subscribers_group_id: admins.id,+ can_remove_subscribers_group: admins.id,};stream_data.add_sub(sub);@@ -979,7 +979,7 @@ test("can_unsubscribe_others", () => {people.initialize_current_user(moderator_user_id);assert.equal(stream_data.can_unsubscribe_others(sub), false);- sub.can_remove_subscribers_group_id = moderators.id;+ sub.can_remove_subscribers_group = moderators.id;people.initialize_current_user(admin_user_id);assert.equal(stream_data.can_unsubscribe_others(sub), true);people.initialize_current_user(moderator_user_id);@@ -987,7 +987,7 @@ test("can_unsubscribe_others", () => {people.initialize_current_user(member_user_id);assert.equal(stream_data.can_unsubscribe_others(sub), false);- sub.can_remove_subscribers_group_id = all.id;+ sub.can_remove_subscribers_group = all.id;people.initialize_current_user(admin_user_id);assert.equal(stream_data.can_unsubscribe_others(sub), true);people.initialize_current_user(moderator_user_id);@@ -996,7 +996,7 @@ test("can_unsubscribe_others", () => {assert.equal(stream_data.can_unsubscribe_others(sub), true);// Even with the nobody system group, admins can still unsubscribe others.- sub.can_remove_subscribers_group_id = nobody.id;+ sub.can_remove_subscribers_group = nobody.id;page_params.is_admin = true;assert.equal(stream_data.can_unsubscribe_others(sub), true);page_params.is_admin = false;diff --git a/web/tests/stream_events.test.js b/web/tests/stream_events.test.jsindex 8d154b76769..3b9d8e3daff 100644--- a/web/tests/stream_events.test.js+++ b/web/tests/stream_events.test.js@@ -249,11 +249,11 @@ test("update_property", ({override, override_rewire}) => {assert.equal(args.val, 20);}- // Test stream can_remove_subscribers_group_id change event+ // Test stream can_remove_subscribers_group change event{const stub = make_stub();override(stream_settings_ui, "update_can_remove_subscribers_group_id", stub.f);- stream_events.update_property(stream_id, "can_remove_subscribers_group_id", 3);+ stream_events.update_property(stream_id, "can_remove_subscribers_group", 3);assert.equal(stub.num_calls, 1);const args = stub.get_args("sub", "val");assert.equal(args.sub.stream_id, stream_id);diff --git a/web/tests/stream_settings_ui.test.js b/web/tests/stream_settings_ui.test.jsindex 17d1ec6d365..74caa7a7d5f 100644--- a/web/tests/stream_settings_ui.test.js+++ b/web/tests/stream_settings_ui.test.js@@ -43,7 +43,7 @@ run_test("redraw_left_panel", ({mock_template}) => {subscribers: [1],stream_weekly_traffic: null,color: "red",- can_remove_subscribers_group_id: admins_group.id,+ can_remove_subscribers_group: admins_group.id,};const poland = {elem: "poland",@@ -54,7 +54,7 @@ run_test("redraw_left_panel", ({mock_template}) => {subscribers: [1, 2, 3],stream_weekly_traffic: 13,color: "red",- can_remove_subscribers_group_id: admins_group.id,+ can_remove_subscribers_group: admins_group.id,};const pomona = {elem: "pomona",@@ -65,7 +65,7 @@ run_test("redraw_left_panel", ({mock_template}) => {subscribers: [],stream_weekly_traffic: 0,color: "red",- can_remove_subscribers_group_id: admins_group.id,+ can_remove_subscribers_group: admins_group.id,};const cpp = {elem: "cpp",@@ -76,7 +76,7 @@ run_test("redraw_left_panel", ({mock_template}) => {subscribers: [1, 2],stream_weekly_traffic: 6,color: "red",- can_remove_subscribers_group_id: admins_group.id,+ can_remove_subscribers_group: admins_group.id,};const zzyzx = {elem: "zzyzx",@@ -87,7 +87,7 @@ run_test("redraw_left_panel", ({mock_template}) => {subscribers: [1, 2],stream_weekly_traffic: 6,color: "red",- can_remove_subscribers_group_id: admins_group.id,+ can_remove_subscribers_group: admins_group.id,};const sub_row_data = [denmark, poland, pomona, cpp, zzyzx];diff --git a/zerver/actions/streams.py b/zerver/actions/streams.pyindex df77311fdde..fd66606e276 100644--- a/zerver/actions/streams.py+++ b/zerver/actions/streams.py@@ -374,7 +374,7 @@ def send_subscription_add_events(stream_weekly_traffic=stream_info.stream_weekly_traffic,subscribers=stream_info.subscribers,# Fields from Stream.API_FIELDS- can_remove_subscribers_group_id=stream_dict["can_remove_subscribers_group_id"],+ can_remove_subscribers_group=stream_dict["can_remove_subscribers_group"],date_created=stream_dict["date_created"],description=stream_dict["description"],first_message_id=stream_dict["first_message_id"],@@ -1440,7 +1440,7 @@ def do_change_stream_group_based_setting(event = dict(op="update",type="stream",- property=setting_name + "_id",+ property=setting_name,value=user_group.id,stream_id=stream.id,name=stream.name,diff --git a/zerver/lib/event_schema.py b/zerver/lib/event_schema.pyindex 2de61754d8f..701055d32cf 100644--- a/zerver/lib/event_schema.py+++ b/zerver/lib/event_schema.py@@ -50,7 +50,7 @@ from zerver.models import Realm, RealmUserDefault, Stream, UserProfile# These fields are used for "stream" events, and are included in the# larger "subscription" events that also contain personal settings.basic_stream_fields = [- ("can_remove_subscribers_group_id", int),+ ("can_remove_subscribers_group", int),("date_created", int),("description", str),("first_message_id", OptionalType(int)),@@ -1282,7 +1282,7 @@ def check_stream_update(elif prop == "stream_post_policy":assert extra_keys == set()assert value in Stream.STREAM_POST_POLICY_TYPES- elif prop == "can_remove_subscribers_group_id":+ elif prop == "can_remove_subscribers_group":assert extra_keys == set()assert isinstance(value, int)else:diff --git a/zerver/lib/subscription_info.py b/zerver/lib/subscription_info.pyindex 5f753f93233..f718c1ae47d 100644--- a/zerver/lib/subscription_info.py+++ b/zerver/lib/subscription_info.py@@ -72,7 +72,7 @@ def get_web_public_subs(realm: Realm) -> SubscriptionInfo:sub = SubscriptionStreamDict(audible_notifications=audible_notifications,- can_remove_subscribers_group_id=can_remove_subscribers_group_id,+ can_remove_subscribers_group=can_remove_subscribers_group_id,color=color,date_created=date_created,description=description,@@ -156,7 +156,7 @@ def build_stream_dict_for_sub(# Our caller may add a subscribers field.return SubscriptionStreamDict(audible_notifications=audible_notifications,- can_remove_subscribers_group_id=can_remove_subscribers_group_id,+ can_remove_subscribers_group=can_remove_subscribers_group_id,color=color,date_created=date_created,description=description,@@ -207,7 +207,7 @@ def build_stream_dict_for_never_sub(# Our caller may add a subscribers field.return NeverSubscribedStreamDict(- can_remove_subscribers_group_id=can_remove_subscribers_group_id,+ can_remove_subscribers_group=can_remove_subscribers_group_id,date_created=date_created,description=description,first_message_id=first_message_id,@@ -443,7 +443,6 @@ def gather_subscriptions_helper(stream_id = get_stream_id(sub_dict)sub_unsub_stream_ids.add(stream_id)raw_stream_dict = all_streams_map[stream_id]-stream_dict = build_stream_dict_for_sub(user=user_profile,sub_dict=sub_dict,diff --git a/zerver/lib/types.py b/zerver/lib/types.pyindex 5d269246ae1..2dde0f0d72f 100644--- a/zerver/lib/types.py+++ b/zerver/lib/types.py@@ -173,7 +173,7 @@ class SubscriptionStreamDict(TypedDict):"""audible_notifications: Optional[bool]- can_remove_subscribers_group_id: int+ can_remove_subscribers_group: intcolor: strdate_created: intdescription: str@@ -200,7 +200,7 @@ class SubscriptionStreamDict(TypedDict):class NeverSubscribedStreamDict(TypedDict):- can_remove_subscribers_group_id: int+ can_remove_subscribers_group: intdate_created: intdescription: strfirst_message_id: Optional[int]@@ -223,7 +223,7 @@ class APIStreamDict(TypedDict):with few exceptions and possible additional fields."""- can_remove_subscribers_group_id: int+ can_remove_subscribers_group: intdate_created: intdescription: strfirst_message_id: Optional[int]diff --git a/zerver/models.py b/zerver/models.pyindex 7c252bc9412..3500db6899b 100644--- a/zerver/models.py+++ b/zerver/models.py@@ -2708,7 +2708,7 @@ class Stream(models.Model):def to_dict(self) -> APIStreamDict:return APIStreamDict(- can_remove_subscribers_group_id=self.can_remove_subscribers_group_id,+ can_remove_subscribers_group=self.can_remove_subscribers_group_id,date_created=datetime_to_timestamp(self.date_created),description=self.description,first_message_id=self.first_message_id,diff --git a/zerver/openapi/zulip.yaml b/zerver/openapi/zulip.yamlindex fb674c31fc5..4f920a4f071 100644--- a/zerver/openapi/zulip.yaml+++ b/zerver/openapi/zulip.yaml@@ -660,7 +660,7 @@ paths:"in_home_view": true,"email_address": "test_stream.af64447e9e39374841063747ade8e6b0.show-sender@testserver","stream_weekly_traffic": null,- "can_remove_subscribers_group_id": 2,+ "can_remove_subscribers_group": 2,"subscribers": [10],},],@@ -1217,7 +1217,7 @@ paths:"first_message_id": null,"message_retention_days": null,"is_announcement_only": false,- "can_remove_subscribers_group_id": 2,+ "can_remove_subscribers_group": 2,},],"id": 0,@@ -1263,7 +1263,7 @@ paths:"first_message_id": null,"message_retention_days": null,"is_announcement_only": false,- "can_remove_subscribers_group_id": 2,+ "can_remove_subscribers_group": 2,},],"id": 0,@@ -1829,7 +1829,7 @@ paths:"first_message_id": 1,"message_retention_days": null,"is_announcement_only": false,- "can_remove_subscribers_group_id": 2,+ "can_remove_subscribers_group": 2,},{"name": "Denmark",@@ -1843,7 +1843,7 @@ paths:"first_message_id": 4,"message_retention_days": null,"is_announcement_only": false,- "can_remove_subscribers_group_id": 2,+ "can_remove_subscribers_group": 2,},{"name": "Verona",@@ -1857,7 +1857,7 @@ paths:"first_message_id": 6,"message_retention_days": null,"is_announcement_only": false,- "can_remove_subscribers_group_id": 2,+ "can_remove_subscribers_group": 2,},],},@@ -1902,7 +1902,7 @@ paths:"first_message_id": 1,"message_retention_days": null,"is_announcement_only": false,- "can_remove_subscribers_group_id": 2,+ "can_remove_subscribers_group": 2,},],"id": 0,@@ -8840,17 +8840,21 @@ paths:- Users can unsubscribe any user from a stream if they [haveaccess](/help/stream-permissions) to the stream and are amember of the [user group](/api/get-user-groups) specified- by the [`can_remove_subscribers_group_id`][can-remove-parameter]+ by the [`can_remove_subscribers_group`][can-remove-parameter]for the stream.- **Changes**: Before Zulip 7.0 (feature level 161), the+ **Changes**: Before Zulip 8.0 (feature level 197),+ the `can_remove_subscribers_group` setting+ was named `can_remove_subscribers_group_id`.++ Before Zulip 7.0 (feature level 161), the`can_remove_subscribers_group_id` for all streams was alwaysthe system group for organization administrators.Before Zulip 6.0 (feature level 145), users had no specialprivileges for managing bots that they own.- [can-remove-parameter]: /api/subscribe#parameter-can_remove_subscribers_group_id+ [can-remove-parameter]: /api/subscribe#parameter-can_remove_subscribers_groupx-curl-examples-parameters:oneOf:- type: include@@ -11571,7 +11575,7 @@ paths:first_message_id:nullable: trueis_announcement_only: {}- can_remove_subscribers_group_id: {}+ can_remove_subscribers_group: {}stream_weekly_traffic:type: integernullable: true@@ -15680,7 +15684,7 @@ paths:first_message_id:nullable: trueis_announcement_only: {}- can_remove_subscribers_group_id: {}+ can_remove_subscribers_group: {}is_default:type: booleandescription: |@@ -15792,7 +15796,7 @@ paths:"rendered_description": "<p>A Scandinavian country</p>","stream_id": 7,"stream_post_policy": 1,- "can_remove_subscribers_group_id": 2,+ "can_remove_subscribers_group": 2,},}"400":@@ -16977,7 +16981,7 @@ components:first_message_id:nullable: trueis_announcement_only: {}- can_remove_subscribers_group_id: {}+ can_remove_subscribers_group: {}BasicStreamBase:type: objectdescription: |@@ -17079,13 +17083,17 @@ components:**Changes**: Deprecated in Zulip 3.0 (feature level 1). Clientsshould use `stream_post_policy` instead.- can_remove_subscribers_group_id:+ can_remove_subscribers_group:type: integerdescription: |ID of the user group whose members are allowed to unsubscribe othersfrom the stream.- **Changes**: New in Zulip 6.0 (feature level 142).+ **Changes**: Before Zulip 8.0 (feature level 197),+ the `can_remove_subscribers_group` setting+ was named `can_remove_subscribers_group_id`.++ New in Zulip 6.0 (feature level 142).BasicBot:allOf:- $ref: "#/components/schemas/BasicBotBase"@@ -17726,13 +17734,17 @@ components:If `null`, the stream was recently created and there isinsufficient data to estimate the average traffic.- can_remove_subscribers_group_id:+ can_remove_subscribers_group:type: integerdescription: |ID of the user group whose members are allowed to unsubscribe othersfrom the stream.- **Changes**: New in Zulip 6.0 (feature level 142).+ **Changes**: Before Zulip 8.0 (feature level 197),+ the `can_remove_subscribers_group` setting+ was named `can_remove_subscribers_group_id`.++ New in Zulip 6.0 (feature level 142).DefaultStreamGroup:type: objectdescription: |@@ -19313,7 +19325,7 @@ components:example: "20"required: falseCanRemoveSubscribersGroupId:- name: can_remove_subscribers_group_id+ name: can_remove_subscribers_groupin: querydescription: |ID of the [user group](/api/get-user-groups) whose members are@@ -19326,7 +19338,11 @@ components:system groups, except for the system groups named`"role:internet"` and `"role:owners"`.- **Changes**: New in Zulip 7.0 (feature level 161).+ **Changes**: Before Zulip 8.0 (feature level 197),+ the `can_remove_subscribers_group` setting+ was named `can_remove_subscribers_group_id`.++ New in Zulip 7.0 (feature level 161).schema:type: integerexample: 20diff --git a/zerver/tests/test_subs.py b/zerver/tests/test_subs.pyindex afd3daa0ad9..dfcb714c3a2 100644--- a/zerver/tests/test_subs.py+++ b/zerver/tests/test_subs.py@@ -226,7 +226,8 @@ class TestMiscStuff(ZulipTestCase):in `APIStreamDict` and `APISubscriptionDict`, respectively."""expected_fields = set(Stream.API_FIELDS) | {"stream_id"}- expected_fields -= {"id"}+ expected_fields -= {"id", "can_remove_subscribers_group_id"}+ expected_fields |= {"can_remove_subscribers_group"}stream_dict_fields = set(APIStreamDict.__annotations__.keys())computed_fields = {"is_announcement_only", "is_default"}@@ -490,7 +491,7 @@ class TestCreateStreams(ZulipTestCase):"subscriptions": orjson.dumps([{"name": "new_stream1", "description": "First new stream"}]).decode(),- "can_remove_subscribers_group_id": orjson.dumps(moderators_system_group.id).decode(),+ "can_remove_subscribers_group": orjson.dumps(moderators_system_group.id).decode(),}result = self.api_post(user, "/api/v1/users/me/subscriptions", post_data, subdomain="zulip")self.assert_json_success(result)@@ -512,7 +513,7 @@ class TestCreateStreams(ZulipTestCase):"subscriptions": orjson.dumps([{"name": "new_stream3", "description": "Third new stream"}]).decode(),- "can_remove_subscribers_group_id": orjson.dumps(hamletcharacters_group.id).decode(),+ "can_remove_subscribers_group": orjson.dumps(hamletcharacters_group.id).decode(),}result = self.api_post(user, "/api/v1/users/me/subscriptions", post_data, subdomain="zulip")self.assert_json_error(@@ -526,7 +527,7 @@ class TestCreateStreams(ZulipTestCase):"subscriptions": orjson.dumps([{"name": "new_stream3", "description": "Third new stream"}]).decode(),- "can_remove_subscribers_group_id": orjson.dumps(internet_group.id).decode(),+ "can_remove_subscribers_group": orjson.dumps(internet_group.id).decode(),}result = self.api_post(user, "/api/v1/users/me/subscriptions", post_data, subdomain="zulip")self.assert_json_error(@@ -539,7 +540,7 @@ class TestCreateStreams(ZulipTestCase):"subscriptions": orjson.dumps([{"name": "new_stream3", "description": "Third new stream"}]).decode(),- "can_remove_subscribers_group_id": orjson.dumps(owners_group.id).decode(),+ "can_remove_subscribers_group": orjson.dumps(owners_group.id).decode(),}result = self.api_post(user, "/api/v1/users/me/subscriptions", post_data, subdomain="zulip")self.assert_json_error(@@ -552,7 +553,7 @@ class TestCreateStreams(ZulipTestCase):"subscriptions": orjson.dumps([{"name": "new_stream3", "description": "Third new stream"}]).decode(),- "can_remove_subscribers_group_id": orjson.dumps(nobody_group.id).decode(),+ "can_remove_subscribers_group": orjson.dumps(nobody_group.id).decode(),}result = self.api_post(user, "/api/v1/users/me/subscriptions", post_data, subdomain="zulip")self.assert_json_error(@@ -2167,14 +2168,14 @@ class StreamAdminTest(ZulipTestCase):self.login("shiva")result = self.client_patch(f"/json/streams/{stream.id}",- {"can_remove_subscribers_group_id": orjson.dumps(moderators_system_group.id).decode()},+ {"can_remove_subscribers_group": orjson.dumps(moderators_system_group.id).decode()},)self.assert_json_error(result, "Must be an organization administrator")self.login("iago")result = self.client_patch(f"/json/streams/{stream.id}",- {"can_remove_subscribers_group_id": orjson.dumps(moderators_system_group.id).decode()},+ {"can_remove_subscribers_group": orjson.dumps(moderators_system_group.id).decode()},)self.assert_json_success(result)stream = get_stream("stream_name1", realm)@@ -2184,7 +2185,7 @@ class StreamAdminTest(ZulipTestCase):hamletcharacters_group = UserGroup.objects.get(name="hamletcharacters", realm=realm)result = self.client_patch(f"/json/streams/{stream.id}",- {"can_remove_subscribers_group_id": orjson.dumps(hamletcharacters_group.id).decode()},+ {"can_remove_subscribers_group": orjson.dumps(hamletcharacters_group.id).decode()},)self.assert_json_error(result, "'can_remove_subscribers_group' must be a system user group."@@ -2195,7 +2196,7 @@ class StreamAdminTest(ZulipTestCase):)result = self.client_patch(f"/json/streams/{stream.id}",- {"can_remove_subscribers_group_id": orjson.dumps(internet_group.id).decode()},+ {"can_remove_subscribers_group": orjson.dumps(internet_group.id).decode()},)self.assert_json_error(result,@@ -2205,7 +2206,7 @@ class StreamAdminTest(ZulipTestCase):owners_group = UserGroup.objects.get(name="role:owners", is_system_group=True, realm=realm)result = self.client_patch(f"/json/streams/{stream.id}",- {"can_remove_subscribers_group_id": orjson.dumps(owners_group.id).decode()},+ {"can_remove_subscribers_group": orjson.dumps(owners_group.id).decode()},)self.assert_json_error(result,@@ -2215,7 +2216,7 @@ class StreamAdminTest(ZulipTestCase):nobody_group = UserGroup.objects.get(name="role:nobody", is_system_group=True, realm=realm)result = self.client_patch(f"/json/streams/{stream.id}",- {"can_remove_subscribers_group_id": orjson.dumps(nobody_group.id).decode()},+ {"can_remove_subscribers_group": orjson.dumps(nobody_group.id).decode()},)self.assert_json_error(result,@@ -2227,14 +2228,14 @@ class StreamAdminTest(ZulipTestCase):stream = self.make_stream("stream_name2", invite_only=True)result = self.client_patch(f"/json/streams/{stream.id}",- {"can_remove_subscribers_group_id": orjson.dumps(moderators_system_group.id).decode()},+ {"can_remove_subscribers_group": orjson.dumps(moderators_system_group.id).decode()},)self.assert_json_error(result, "Invalid stream ID")self.subscribe(user_profile, "stream_name2")result = self.client_patch(f"/json/streams/{stream.id}",- {"can_remove_subscribers_group_id": orjson.dumps(moderators_system_group.id).decode()},+ {"can_remove_subscribers_group": orjson.dumps(moderators_system_group.id).decode()},)self.assert_json_success(result)stream = get_stream("stream_name2", realm)@@ -5800,7 +5801,8 @@ class GetSubscribersTest(ZulipTestCase):}expected_fields = set(Stream.API_FIELDS) | set(Subscription.API_FIELDS) | other_fields- expected_fields -= {"id"}+ expected_fields -= {"id", "can_remove_subscribers_group_id"}+ expected_fields |= {"can_remove_subscribers_group"}for lst in [sub_data.subscriptions, sub_data.unsubscribed]:for sub in lst:@@ -5814,7 +5816,8 @@ class GetSubscribersTest(ZulipTestCase):}expected_fields = set(Stream.API_FIELDS) | other_fields- expected_fields -= {"id"}+ expected_fields -= {"id", "can_remove_subscribers_group_id"}+ expected_fields |= {"can_remove_subscribers_group"}for never_sub in sub_data.never_subscribed:self.assertEqual(set(never_sub), expected_fields)diff --git a/zerver/views/streams.py b/zerver/views/streams.pyindex 948034815dd..df23804cd04 100644--- a/zerver/views/streams.py+++ b/zerver/views/streams.py@@ -269,7 +269,9 @@ def update_stream_backend(message_retention_days: Optional[Union[int, str]] = REQ(json_validator=check_string_or_int, default=None),- can_remove_subscribers_group_id: Optional[int] = REQ(json_validator=check_int, default=None),+ can_remove_subscribers_group_id: Optional[int] = REQ(+ "can_remove_subscribers_group", json_validator=check_int, default=None+ ),) -> HttpResponse:# We allow realm administrators to to update the stream name and# description even for private streams.@@ -393,7 +395,7 @@ def update_stream_backend(if request_settings_dict[setting_group_id_name] is not None and request_settings_dict[setting_group_id_name- ] != getattr(stream, setting_name):+ ] != getattr(stream, setting_group_id_name):if sub is None and stream.invite_only:# Admins cannot change this setting for unsubscribed private streams.raise JsonableError(_("Invalid stream ID"))@@ -570,7 +572,9 @@ def add_subscriptions_backend(message_retention_days: Union[str, int] = REQ(json_validator=check_string_or_int, default=RETENTION_DEFAULT),- can_remove_subscribers_group_id: Optional[int] = REQ(json_validator=check_int, default=None),+ can_remove_subscribers_group_id: Optional[int] = REQ(+ "can_remove_subscribers_group", json_validator=check_int, default=None+ ),announce: bool = REQ(json_validator=check_bool, default=False),principals: Union[Sequence[str], Sequence[int]] = REQ(json_validator=check_principals,@@ -591,11 +595,11 @@ def add_subscriptions_backend(allow_nobody_group=False,)else:- can_remove_subscribers_group_default = Stream.stream_permission_group_settings[+ can_remove_subscribers_group_default_name = Stream.stream_permission_group_settings["can_remove_subscribers_group"].default_group_namecan_remove_subscribers_group = UserGroup.objects.get(- name=can_remove_subscribers_group_default,+ name=can_remove_subscribers_group_default_name,realm=user_profile.realm,is_system_group=True,)