Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
stream_setting: Add setting for who can move messages within channel.
Vector73703601a5d519
diff --git a/api_docs/changelog.md b/api_docs/changelog.mdindex 774f9f4f30a..2259ffa039c 100644--- a/api_docs/changelog.md+++ b/api_docs/changelog.md@@ -20,6 +20,19 @@ format used by the Zulip server that they are interacting with.## Changes in Zulip 11.0+**Feature level 396**++* [`GET /users/me/subscriptions`](/api/get-subscriptions),+ [`GET /streams`](/api/get-streams), [`GET /events`](/api/get-events),+ [`POST /register`](/api/register-queue): Added `can_move_messages_within_channel_group`+ field which is a [group-setting value](/api/group-setting-values) describing the+ set of users with permissions to move messages within the channel.+* [`POST /users/me/subscriptions`](/api/subscribe),+ [`PATCH /streams/{stream_id}`](/api/update-stream): Added+ `can_move_messages_within_channel_group` parameter to support setting and+ changing the user group whose members can move messages within the specified+ channel.+**Feature level 395*** [Markdown messagediff --git a/web/src/group_permission_settings.ts b/web/src/group_permission_settings.tsindex af8ddbc7247..3aa64619a1c 100644--- a/web/src/group_permission_settings.ts+++ b/web/src/group_permission_settings.ts@@ -71,6 +71,7 @@ export type RealmGroupSettingName = z.infer<typeof realm_group_setting_name_scheexport const stream_group_setting_name_schema = z.enum(["can_add_subscribers_group","can_administer_channel_group",+ "can_move_messages_within_channel_group","can_remove_subscribers_group","can_send_message_group","can_subscribe_group",diff --git a/web/src/message_edit.ts b/web/src/message_edit.tsindex 628c8514bea..6d1c4dc6203 100644--- a/web/src/message_edit.ts+++ b/web/src/message_edit.ts@@ -110,7 +110,9 @@ export function is_topic_editable(message: Message, edit_limit_seconds_buffer =return false;}- if (!settings_data.user_can_move_messages_to_another_topic()) {+ const stream = stream_data.get_sub_by_id(message.stream_id);+ assert(stream !== undefined);+ if (!stream_data.user_can_move_messages_within_channel(stream)) {return false;}diff --git a/web/src/popover_menus_data.ts b/web/src/popover_menus_data.tsindex 1c8ea44efad..2e621b90e87 100644--- a/web/src/popover_menus_data.ts+++ b/web/src/popover_menus_data.ts@@ -265,8 +265,7 @@ export function get_topic_popover_content_context({const has_unread_messages = num_unread_for_topic(sub.stream_id, topic_name) > 0;const can_move_topic =!sub.is_archived && settings_data.user_can_move_messages_between_streams();- const can_rename_topic =- !sub.is_archived && settings_data.user_can_move_messages_to_another_topic();+ const can_rename_topic = stream_data.user_can_move_messages_within_channel(sub);const can_resolve_topic = !sub.is_archived && settings_data.user_can_resolve_topic();const visibility_policy = user_topics.get_topic_visibility_policy(sub.stream_id, topic_name);const all_visibility_policies = user_topics.all_visibility_policies;diff --git a/web/src/settings_components.ts b/web/src/settings_components.tsindex 984fa2ba1f4..d96a90d1468 100644--- a/web/src/settings_components.ts+++ b/web/src/settings_components.ts@@ -1575,6 +1575,7 @@ export const group_setting_widget_map = new Map<string, GroupSettingPillContaine["can_leave_group", null],["can_manage_group", null],["can_mention_group", null],+ ["can_move_messages_within_channel_group", null],["can_remove_members_group", null],["can_remove_subscribers_group", null],["can_send_message_group", null],diff --git a/web/src/settings_config.ts b/web/src/settings_config.tsindex 4a96bfbb200..6bd8b8cba56 100644--- a/web/src/settings_config.ts+++ b/web/src/settings_config.ts@@ -744,6 +744,9 @@ export const all_group_setting_labels = {},stream: {can_add_subscribers_group: $t({defaultMessage: "Who can subscribe anyone to this channel"}),+ can_move_messages_within_channel_group: $t({+ defaultMessage: "Who can move messages inside this channel",+ }),can_send_message_group: $t({defaultMessage: "Who can post to this channel"}),can_administer_channel_group: $t({defaultMessage: "Who can administer this channel"}),can_subscribe_group: $t({defaultMessage: "Who can subscribe to this channel"}),@@ -840,6 +843,7 @@ export const owner_editable_realm_group_permission_settings = new Set([export const stream_group_permission_settings: StreamGroupSettingName[] = ["can_send_message_group","can_administer_channel_group",+ "can_move_messages_within_channel_group","can_subscribe_group","can_add_subscribers_group","can_remove_subscribers_group",diff --git a/web/src/stream_create.ts b/web/src/stream_create.tsindex b3ab1c88427..3c201a81467 100644--- a/web/src/stream_create.ts+++ b/web/src/stream_create.ts@@ -77,6 +77,7 @@ export function maybe_update_error_message(): void {const group_setting_widget_map = new Map<string, GroupSettingPillContainer | null>([["can_add_subscribers_group", null],["can_administer_channel_group", null],+ ["can_move_messages_within_channel_group", null],["can_remove_subscribers_group", null],["can_send_message_group", null],]);diff --git a/web/src/stream_data.ts b/web/src/stream_data.tsindex aa77c7245bb..ac9029eb753 100644--- a/web/src/stream_data.ts+++ b/web/src/stream_data.ts@@ -825,6 +825,35 @@ export function rewire_can_post_messages_in_stream(can_post_messages_in_stream = value;}+export function user_can_move_messages_within_channel(stream: StreamSubscription): boolean {+ if (page_params.is_spectator) {+ return false;+ }++ if (stream.is_archived) {+ return false;+ }++ const user_can_administer_channel = settings_data.user_has_permission_for_group_setting(+ stream.can_administer_channel_group,+ "can_administer_channel_group",+ "stream",+ );++ if (user_can_administer_channel) {+ return true;+ }++ return (+ settings_data.user_can_move_messages_to_another_topic() ||+ settings_data.user_has_permission_for_group_setting(+ stream.can_move_messages_within_channel_group,+ "can_move_messages_within_channel_group",+ "stream",+ )+ );+}+export function is_subscribed(stream_id: number): boolean {const sub = sub_store.get(stream_id);return sub ? sub.subscribed : false;diff --git a/web/src/stream_popover.ts b/web/src/stream_popover.tsindex 9fb6d1de363..a0822c78d1d 100644--- a/web/src/stream_popover.ts+++ b/web/src/stream_popover.ts@@ -353,6 +353,7 @@ export async function build_move_topic_to_stream_popover(): Promise<void> {const current_stream_name = sub_store.get(current_stream_id)!.name;const stream = sub_store.get(current_stream_id);+ assert(stream !== undefined);const topic_display_name = util.get_final_topic_display_name(topic_name);const empty_string_topic_display_name = util.get_final_topic_display_name("");const is_empty_string_topic = topic_name === "";@@ -387,7 +388,7 @@ export async function build_move_topic_to_stream_popover(// available and thus we check the time-based permissions as well in the// below if block to enable or disable the stream and topic input.let disable_stream_input = !settings_data.user_can_move_messages_between_streams();- args.disable_topic_input = !settings_data.user_can_move_messages_to_another_topic();+ args.disable_topic_input = !stream_data.user_can_move_messages_within_channel(stream);let modal_heading;if (only_topic_edit) {@@ -772,7 +773,23 @@ export async function build_move_topic_to_stream_popover(return false;}let {new_topic_name} = get_params_from_form();- if (!settings_data.user_can_move_messages_to_another_topic()) {++ const current_stream = stream_data.get_sub_by_id(current_stream_id);+ const selected_stream = stream_data.get_sub_by_id(+ curr_selected_stream || current_stream_id,+ );++ assert(current_stream !== undefined);+ assert(selected_stream !== undefined);++ // Users can only edit topic if they have either of these permissions:+ // 1) organization-level permission to edit topics+ // 2) channel-level permission to edit topics in the current channel+ // 3) channel-level permission to edit topics in the selected channel+ if (+ !stream_data.user_can_move_messages_within_channel(current_stream) &&+ !stream_data.user_can_move_messages_within_channel(selected_stream)+ ) {// new_topic_name is undefined since the new topic input is disabled when// user does not have permission to edit topic.new_topic_name = args.topic_name;@@ -835,9 +852,33 @@ export async function build_move_topic_to_stream_popover(function move_topic_on_update(event: JQuery.ClickEvent, dropdown: {hide: () => void}): void {stream_widget_value = Number.parseInt($(event.currentTarget).attr("data-unique-id")!, 10);const $topic_input = $<HTMLInputElement>("#move_topic_form input.move_messages_edit_topic");+ curr_selected_stream = stream_widget_value;+ const params = get_params_from_form();+ const current_stream = stream_data.get_sub_by_id(current_stream_id);+ const selected_stream = stream_data.get_sub_by_id(+ curr_selected_stream || current_stream_id,+ );++ assert(current_stream !== undefined);+ assert(selected_stream !== undefined);++ // Enable topic editing only if the user has at least one of these permissions:+ // 1) organization-level permission to edit topics+ // 2) channel-level permission to edit topics in the current channel+ // 3) channel-level permission to edit topics in the selected channel+ // If none apply, disable the input and reset it to the original topic name.+ if (+ stream_data.user_can_move_messages_within_channel(current_stream) ||+ stream_data.user_can_move_messages_within_channel(selected_stream)+ ) {+ $topic_input.prop("disabled", false);+ } else {+ $topic_input.val(params.old_topic_name);+ $topic_input.prop("disabled", true);+ }+const topic_input_value = $topic_input.val();assert(topic_input_value !== undefined);- curr_selected_stream = stream_widget_value;update_submit_button_disabled_state(stream_widget_value);set_stream_topic_typeahead();@@ -852,7 +893,7 @@ export async function build_move_topic_to_stream_popover(event.stopPropagation();// Move focus to the topic input after a new stream is selected.- $("#move_topic_form .move_messages_edit_topic").trigger("focus");+ $topic_input.trigger("focus");}// The following logic is correct only whendiff --git a/web/src/stream_types.ts b/web/src/stream_types.tsindex a20d494f616..fac12bae9ef 100644--- a/web/src/stream_types.ts+++ b/web/src/stream_types.ts@@ -13,6 +13,7 @@ export type StreamPostPolicy = (typeof StreamPostPolicy)[keyof typeof StreamPostexport const stream_permission_group_settings_schema = z.enum(["can_add_subscribers_group","can_administer_channel_group",+ "can_move_messages_within_channel_group","can_remove_subscribers_group","can_send_message_group","can_subscribe_group",@@ -30,6 +31,7 @@ export type StreamTopicsPolicy = z.infer<typeof stream_topics_policy_schema>;export const stream_schema = z.object({can_add_subscribers_group: group_setting_value_schema,can_administer_channel_group: group_setting_value_schema,+ can_move_messages_within_channel_group: group_setting_value_schema,can_remove_subscribers_group: group_setting_value_schema,can_send_message_group: group_setting_value_schema,can_subscribe_group: group_setting_value_schema,diff --git a/web/templates/stream_settings/stream_types.hbs b/web/templates/stream_settings/stream_types.hbsindex ebd4f7aa98f..d1292fe8239 100644--- a/web/templates/stream_settings/stream_types.hbs+++ b/web/templates/stream_settings/stream_types.hbs@@ -126,6 +126,11 @@label=group_setting_labels.can_remove_subscribers_groupprefix=prefix }}+ {{> ../settings/group_setting_value_pill_input+ setting_name="can_move_messages_within_channel_group"+ label=group_setting_labels.can_move_messages_within_channel_group+ prefix=prefix }}+{{#if (or is_owner is_stream_edit)}}<div>diff --git a/web/tests/compose_validate.test.cjs b/web/tests/compose_validate.test.cjsindex 36ae439c35b..9b30674cd78 100644--- a/web/tests/compose_validate.test.cjs+++ b/web/tests/compose_validate.test.cjs@@ -784,6 +784,8 @@ test_ui("test warn_if_topic_resolved", ({override, mock_template}) => {const sub = {stream_id: 111,name: "random",+ can_administer_channel_group: nobody.id,+ can_move_messages_within_channel_group: nobody.id,};stream_data.add_sub(sub);diff --git a/web/tests/lib/events.cjs b/web/tests/lib/events.cjsindex d263c8c0ec0..9281d572a05 100644--- a/web/tests/lib/events.cjs+++ b/web/tests/lib/events.cjs@@ -56,6 +56,7 @@ exports.test_streams = {stream_post_policy: 1,topics_policy: "inherit",can_administer_channel_group: 2,+ can_move_messages_within_channel_group: 2,can_send_message_group: 2,can_remove_subscribers_group: 2,is_recently_active: true,@@ -77,6 +78,7 @@ exports.test_streams = {stream_post_policy: 1,topics_policy: "inherit",can_administer_channel_group: 2,+ can_move_messages_within_channel_group: 2,can_send_message_group: 2,can_remove_subscribers_group: 2,is_recently_active: true,diff --git a/web/tests/message_edit.test.cjs b/web/tests/message_edit.test.cjsindex 7fc61006db2..70f0b359056 100644--- a/web/tests/message_edit.test.cjs+++ b/web/tests/message_edit.test.cjs@@ -12,6 +12,7 @@ const {set_current_user, set_realm} = zrequire("state_data");const is_content_editable = message_edit.is_content_editable;const settings_data = mock_esm("../src/settings_data");+const stream_data = mock_esm("../src/stream_data");const realm = {};set_realm(realm);@@ -94,7 +95,9 @@ run_test("is_topic_editable", ({override}) => {type: "stream",};override(realm, "realm_allow_message_editing", true);- override(settings_data, "user_can_move_messages_to_another_topic", () => true);+ override(stream_data, "is_stream_archived", () => false);+ override(stream_data, "user_can_move_messages_within_channel", () => true);+ override(stream_data, "get_sub_by_id", () => ({}));override(current_user, "is_moderator", true);assert.equal(message_edit.is_topic_editable(message), false);@@ -109,7 +112,7 @@ run_test("is_topic_editable", ({override}) => {message.sent_by_me = false;assert.equal(message_edit.is_topic_editable(message), true);- override(settings_data, "user_can_move_messages_to_another_topic", () => false);+ override(stream_data, "user_can_move_messages_within_channel", () => false);assert.equal(message_edit.is_topic_editable(message), false);override(current_user, "is_moderator", false);@@ -119,13 +122,13 @@ run_test("is_topic_editable", ({override}) => {assert.equal(message_edit.is_topic_editable(message), false);message.topic = "test topic";- override(settings_data, "user_can_move_messages_to_another_topic", () => false);+ override(stream_data, "user_can_move_messages_within_channel", () => false);assert.equal(message_edit.is_topic_editable(message), false);override(realm, "realm_move_messages_within_stream_limit_seconds", 259200);message.timestamp = current_timestamp - 60;- override(settings_data, "user_can_move_messages_to_another_topic", () => true);+ override(stream_data, "user_can_move_messages_within_channel", () => true);assert.equal(message_edit.is_topic_editable(message), true);message.timestamp = current_timestamp - 600000;@@ -150,6 +153,7 @@ run_test("is_stream_editable", ({override}) => {override(realm, "realm_allow_message_editing", true);override(settings_data, "user_can_move_messages_between_streams", () => true);override(current_user, "is_moderator", true);+ override(stream_data, "is_stream_archived", () => false);assert.equal(message_edit.is_stream_editable(message), false);diff --git a/web/tests/popover_menus_data.test.cjs b/web/tests/popover_menus_data.test.cjsindex e6ca26ce8c8..71ce81ad406 100644--- a/web/tests/popover_menus_data.test.cjs+++ b/web/tests/popover_menus_data.test.cjs@@ -54,6 +54,8 @@ mock_esm("../src/hash_util", {mock_esm("../src/stream_data", {is_subscribed: () => true,is_stream_archived: () => false,+ get_sub_by_id: () => noop,+ user_can_move_messages_within_channel: () => true,});mock_esm("../src/group_permission_settings", {get_group_permission_setting_config() {diff --git a/web/tests/stream_data.test.cjs b/web/tests/stream_data.test.cjsindex 7a5874bbc81..4c62c07a90d 100644--- a/web/tests/stream_data.test.cjs+++ b/web/tests/stream_data.test.cjs@@ -1518,6 +1518,41 @@ test("can_post_messages_in_stream", ({override}) => {assert.equal(stream_data.can_post_messages_in_stream(social), false);});+test("can_move_messages_within_channel", ({override}) => {+ const social = {+ subscribed: true,+ name: "social",+ stream_id: 10,+ can_administer_channel_group: nobody_group.id,+ can_move_messages_within_channel_group: nobody_group.id,+ };+ const scotland = {+ subscribed: true,+ name: "scotland",+ stream_id: 11,+ can_administer_channel_group: nobody_group.id,+ can_move_messages_within_channel_group: everyone_group.id,+ };++ override(realm, "realm_can_move_messages_between_topics_group", nobody_group.id);+ override(current_user, "user_id", admin_user_id);+ assert.equal(stream_data.user_can_move_messages_within_channel(social), false);+ social.can_administer_channel_group = admins_group.id;+ assert.equal(stream_data.user_can_move_messages_within_channel(social), true);++ override(current_user, "user_id", moderator_user_id);+ assert.equal(stream_data.user_can_move_messages_within_channel(social), false);++ assert.equal(stream_data.user_can_move_messages_within_channel(scotland), true);++ page_params.is_spectator = true;+ assert.equal(stream_data.user_can_move_messages_within_channel(scotland), false);++ page_params.is_spectator = false;+ scotland.is_archived = true;+ assert.equal(stream_data.user_can_move_messages_within_channel(scotland), false);+});+test("can_unsubscribe_others", ({override}) => {const sub = {name: "Denmark",diff --git a/zerver/actions/message_edit.py b/zerver/actions/message_edit.pyindex 230658575d0..892a91a7a5e 100644--- a/zerver/actions/message_edit.py+++ b/zerver/actions/message_edit.py@@ -55,6 +55,7 @@ from zerver.lib.streams import (access_stream_by_id,access_stream_by_id_for_message,can_access_stream_history,+ can_edit_topic,check_stream_access_based_on_can_send_message_group,get_stream_topics_policy,notify_stream_is_recently_active_update,@@ -1494,7 +1495,9 @@ def check_update_message(if not user_profile.can_resolve_topic():raise JsonableError(_("You don't have permission to resolve topics."))else:- if not user_profile.can_move_messages_to_another_topic():+ if not can_edit_topic(+ user_profile, message_edit_request.orig_stream, message_edit_request.target_stream+ ):raise JsonableError(_("You don't have permission to edit this message"))# If there is a change to the topic, check that the user is allowed todiff --git a/zerver/actions/streams.py b/zerver/actions/streams.pyindex fca4b9a3274..adb1cc2f39a 100644--- a/zerver/actions/streams.py+++ b/zerver/actions/streams.py@@ -458,6 +458,9 @@ def send_subscription_add_events(is_archived=stream_dict["is_archived"],can_add_subscribers_group=stream_dict["can_add_subscribers_group"],can_administer_channel_group=stream_dict["can_administer_channel_group"],+ can_move_messages_within_channel_group=stream_dict[+ "can_move_messages_within_channel_group"+ ],can_send_message_group=stream_dict["can_send_message_group"],can_remove_subscribers_group=stream_dict["can_remove_subscribers_group"],can_subscribe_group=stream_dict["can_subscribe_group"],diff --git a/zerver/lib/event_types.py b/zerver/lib/event_types.pyindex d09d0e6cca0..e9090a6de0d 100644--- a/zerver/lib/event_types.py+++ b/zerver/lib/event_types.py@@ -824,6 +824,7 @@ class EventScheduledMessagesUpdate(BaseEvent):class BasicStreamFields(BaseModel):is_archived: boolcan_administer_channel_group: int | UserGroupMembersDict+ can_move_messages_within_channel_group: int | UserGroupMembersDictcan_remove_subscribers_group: int | UserGroupMembersDictcan_send_message_group: int | UserGroupMembersDictcreator_id: int | None@@ -887,6 +888,7 @@ class EventSubmessage(BaseEvent):class SingleSubscription(BaseModel):is_archived: boolcan_administer_channel_group: int | UserGroupMembersDict+ can_move_messages_within_channel_group: int | UserGroupMembersDictcan_remove_subscribers_group: int | UserGroupMembersDictcan_send_message_group: int | UserGroupMembersDictcreator_id: int | Nonediff --git a/zerver/lib/streams.py b/zerver/lib/streams.pyindex f856d0b1ea7..a536e033d0f 100644--- a/zerver/lib/streams.py+++ b/zerver/lib/streams.py@@ -88,6 +88,7 @@ class StreamDict(TypedDict, total=False):topics_policy: int | Nonecan_add_subscribers_group: UserGroup | Nonecan_administer_channel_group: UserGroup | None+ can_move_messages_within_channel_group: UserGroup | Nonecan_send_message_group: UserGroup | Nonecan_remove_subscribers_group: UserGroup | Nonecan_subscribe_group: UserGroup | None@@ -273,6 +274,7 @@ def create_stream_if_needed(topics_policy: int | None = None,can_add_subscribers_group: UserGroup | None = None,can_administer_channel_group: UserGroup | None = None,+ can_move_messages_within_channel_group: UserGroup | None = None,can_send_message_group: UserGroup | None = None,can_remove_subscribers_group: UserGroup | None = None,can_subscribe_group: UserGroup | None = None,@@ -398,6 +400,9 @@ def create_streams_if_needed(topics_policy=stream_dict.get("topics_policy", None),can_add_subscribers_group=stream_dict.get("can_add_subscribers_group", None),can_administer_channel_group=stream_dict.get("can_administer_channel_group", None),+ can_move_messages_within_channel_group=stream_dict.get(+ "can_move_messages_within_channel_group", None+ ),can_send_message_group=stream_dict.get("can_send_message_group", None),can_remove_subscribers_group=stream_dict.get("can_remove_subscribers_group", None),can_subscribe_group=stream_dict.get("can_subscribe_group", None),@@ -1075,6 +1080,38 @@ def can_access_stream_history_by_id(user_profile: UserProfile, stream_id: int) -return can_access_stream_history(user_profile, stream)+def can_move_messages_within_channel(user_profile: UserProfile, stream: Stream) -> bool:+ if user_profile.is_realm_admin or can_administer_accessible_channel(stream, user_profile):+ return True++ return user_has_permission_for_group_setting(+ stream.can_move_messages_within_channel_group_id,+ user_profile,+ Stream.stream_permission_group_settings["can_move_messages_within_channel_group"],+ direct_member_only=False,+ )+++def can_edit_topic(user_profile: UserProfile, orig_stream: Stream, target_stream: Stream) -> bool:+ # Users can only edit topics if they have either of these permissions:+ # 1) organization-level permission to edit topics+ # 2) channel-level permission to edit topics in the original channel+ # 3) channel-level permission to edit topics in the target channel+ # If none apply, throw error.+ if user_profile.can_move_messages_to_another_topic():+ return True++ if can_move_messages_within_channel(user_profile, orig_stream):+ return True++ if orig_stream.id != target_stream.id and can_move_messages_within_channel(+ user_profile, target_stream+ ):+ return True++ return False++def bulk_can_remove_subscribers_from_streams(streams: list[Stream], user_profile: UserProfile) -> bool:@@ -1501,6 +1538,9 @@ def stream_to_dict(can_administer_channel_group = get_group_setting_value_for_register_api(stream.can_administer_channel_group_id, anonymous_group_membership)+ can_move_messages_within_channel_group = get_group_setting_value_for_register_api(+ stream.can_move_messages_within_channel_group_id, anonymous_group_membership+ )can_send_message_group = get_group_setting_value_for_register_api(stream.can_send_message_group_id, anonymous_group_membership)@@ -1519,6 +1559,7 @@ def stream_to_dict(is_archived=stream.deactivated,can_add_subscribers_group=can_add_subscribers_group,can_administer_channel_group=can_administer_channel_group,+ can_move_messages_within_channel_group=can_move_messages_within_channel_group,can_send_message_group=can_send_message_group,can_remove_subscribers_group=can_remove_subscribers_group,can_subscribe_group=can_subscribe_group,diff --git a/zerver/lib/subscription_info.py b/zerver/lib/subscription_info.pyindex a4dd8282636..7e252a5723a 100644--- a/zerver/lib/subscription_info.py+++ b/zerver/lib/subscription_info.py@@ -70,6 +70,9 @@ def get_web_public_subs(can_administer_channel_group = get_group_setting_value_for_register_api(stream.can_administer_channel_group_id, anonymous_group_membership)+ can_move_messages_within_channel_group = get_group_setting_value_for_register_api(+ stream.can_move_messages_within_channel_group_id, anonymous_group_membership+ )can_send_message_group = get_group_setting_value_for_register_api(stream.can_send_message_group_id, anonymous_group_membership)@@ -118,6 +121,7 @@ def get_web_public_subs(audible_notifications=audible_notifications,can_add_subscribers_group=can_add_subscribers_group,can_administer_channel_group=can_administer_channel_group,+ can_move_messages_within_channel_group=can_move_messages_within_channel_group,can_send_message_group=can_send_message_group,can_remove_subscribers_group=can_remove_subscribers_group,can_subscribe_group=can_subscribe_group,@@ -189,6 +193,9 @@ def build_stream_api_dict(can_administer_channel_group = get_group_setting_value_for_register_api(raw_stream_dict["can_administer_channel_group_id"], anonymous_group_membership)+ can_move_messages_within_channel_group = get_group_setting_value_for_register_api(+ raw_stream_dict["can_move_messages_within_channel_group_id"], anonymous_group_membership+ )can_send_message_group = get_group_setting_value_for_register_api(raw_stream_dict["can_send_message_group_id"], anonymous_group_membership)@@ -203,6 +210,7 @@ def build_stream_api_dict(is_archived=raw_stream_dict["deactivated"],can_add_subscribers_group=can_add_subscribers_group,can_administer_channel_group=can_administer_channel_group,+ can_move_messages_within_channel_group=can_move_messages_within_channel_group,can_send_message_group=can_send_message_group,can_remove_subscribers_group=can_remove_subscribers_group,can_subscribe_group=can_subscribe_group,@@ -236,6 +244,7 @@ def build_stream_dict_for_sub(is_archived = stream_dict["is_archived"]can_add_subscribers_group = stream_dict["can_add_subscribers_group"]can_administer_channel_group = stream_dict["can_administer_channel_group"]+ can_move_messages_within_channel_group = stream_dict["can_move_messages_within_channel_group"]can_send_message_group = stream_dict["can_send_message_group"]can_remove_subscribers_group = stream_dict["can_remove_subscribers_group"]can_subscribe_group = stream_dict["can_subscribe_group"]@@ -278,6 +287,7 @@ def build_stream_dict_for_sub(audible_notifications=audible_notifications,can_add_subscribers_group=can_add_subscribers_group,can_administer_channel_group=can_administer_channel_group,+ can_move_messages_within_channel_group=can_move_messages_within_channel_group,can_send_message_group=can_send_message_group,can_remove_subscribers_group=can_remove_subscribers_group,can_subscribe_group=can_subscribe_group,@@ -346,6 +356,9 @@ def build_stream_dict_for_never_sub(can_administer_channel_group_value = get_group_setting_value_for_register_api(raw_stream_dict["can_administer_channel_group_id"], anonymous_group_membership)+ can_move_messages_within_channel_group_value = get_group_setting_value_for_register_api(+ raw_stream_dict["can_move_messages_within_channel_group_id"], anonymous_group_membership+ )can_send_message_group_value = get_group_setting_value_for_register_api(raw_stream_dict["can_send_message_group_id"], anonymous_group_membership)@@ -364,6 +377,7 @@ def build_stream_dict_for_never_sub(is_archived=is_archived,can_add_subscribers_group=can_add_subscribers_group_value,can_administer_channel_group=can_administer_channel_group_value,+ can_move_messages_within_channel_group=can_move_messages_within_channel_group_value,can_send_message_group=can_send_message_group_value,can_remove_subscribers_group=can_remove_subscribers_group_value,can_subscribe_group=can_subscribe_group_value,diff --git a/zerver/lib/types.py b/zerver/lib/types.pyindex 2733021f40d..13cec15f32e 100644--- a/zerver/lib/types.py+++ b/zerver/lib/types.py@@ -160,6 +160,7 @@ class RawStreamDict(TypedDict):can_add_subscribers_group_id: intcan_administer_channel_group_id: int+ can_move_messages_within_channel_group_id: intcan_send_message_group_id: intcan_remove_subscribers_group_id: intcan_subscribe_group_id: int@@ -209,6 +210,7 @@ class SubscriptionStreamDict(TypedDict):audible_notifications: bool | Nonecan_add_subscribers_group: int | UserGroupMembersDictcan_administer_channel_group: int | UserGroupMembersDict+ can_move_messages_within_channel_group: int | UserGroupMembersDictcan_send_message_group: int | UserGroupMembersDictcan_remove_subscribers_group: int | UserGroupMembersDictcan_subscribe_group: int | UserGroupMembersDict@@ -247,6 +249,7 @@ class NeverSubscribedStreamDict(TypedDict):is_archived: boolcan_add_subscribers_group: int | UserGroupMembersDictcan_administer_channel_group: int | UserGroupMembersDict+ can_move_messages_within_channel_group: int | UserGroupMembersDictcan_send_message_group: int | UserGroupMembersDictcan_remove_subscribers_group: int | UserGroupMembersDictcan_subscribe_group: int | UserGroupMembersDict@@ -281,6 +284,7 @@ class DefaultStreamDict(TypedDict):is_archived: boolcan_add_subscribers_group: int | UserGroupMembersDictcan_administer_channel_group: int | UserGroupMembersDict+ can_move_messages_within_channel_group: int | UserGroupMembersDictcan_send_message_group: int | UserGroupMembersDictcan_remove_subscribers_group: int | UserGroupMembersDictcan_subscribe_group: int | UserGroupMembersDictdiff --git a/zerver/migrations/0719_stream_can_move_messages_within_channel_group.py b/zerver/migrations/0719_stream_can_move_messages_within_channel_group.pynew file mode 100644index 00000000000..74fde6f4a11--- /dev/null+++ b/zerver/migrations/0719_stream_can_move_messages_within_channel_group.py@@ -0,0 +1,23 @@+# Generated by Django 5.1.8 on 2025-06-05 07:43++import django.db.models.deletion+from django.db import migrations, models+++class Migration(migrations.Migration):+ dependencies = [+ ("zerver", "0718_fix_topics_for_direct_messages"),+ ]++ operations = [+ migrations.AddField(+ model_name="stream",+ name="can_move_messages_within_channel_group",+ field=models.ForeignKey(+ null=True,+ on_delete=django.db.models.deletion.RESTRICT,+ related_name="+",+ to="zerver.usergroup",+ ),+ ),+ ]diff --git a/zerver/migrations/0720_set_default_value_for_can_move_messages_within_channel_group.py b/zerver/migrations/0720_set_default_value_for_can_move_messages_within_channel_group.pynew file mode 100644index 00000000000..93ca774d58e--- /dev/null+++ b/zerver/migrations/0720_set_default_value_for_can_move_messages_within_channel_group.py@@ -0,0 +1,56 @@+from django.db import migrations, transaction+from django.db.backends.base.schema import BaseDatabaseSchemaEditor+from django.db.migrations.state import StateApps+from django.db.models import Max, Min, OuterRef+++def set_default_value_for_can_move_messages_within_channel_group(+ apps: StateApps, schema_editor: BaseDatabaseSchemaEditor+) -> None:+ Stream = apps.get_model("zerver", "stream")+ NamedUserGroup = apps.get_model("zerver", "NamedUserGroup")+ BATCH_SIZE = 1000++ max_id = Stream.objects.filter(can_move_messages_within_channel_group=None).aggregate(+ Max("id")+ )["id__max"]+ if max_id is None:+ # Do nothing if there are no channels on the server.+ return++ lower_bound = Stream.objects.filter(can_move_messages_within_channel_group=None).aggregate(+ Min("id")+ )["id__min"]+ while lower_bound <= max_id + BATCH_SIZE / 2:+ upper_bound = lower_bound + BATCH_SIZE - 1+ print(f"Processing batch {lower_bound} to {upper_bound} for Stream")++ with transaction.atomic():+ Stream.objects.filter(+ id__range=(lower_bound, upper_bound),+ can_move_messages_within_channel_group=None,+ ).update(+ can_move_messages_within_channel_group=NamedUserGroup.objects.filter(+ name="role:nobody",+ realm_for_sharding=OuterRef("realm_id"),+ is_system_group=True,+ ).values("pk")+ )++ lower_bound += BATCH_SIZE+++class Migration(migrations.Migration):+ atomic = False++ dependencies = [+ ("zerver", "0719_stream_can_move_messages_within_channel_group"),+ ]++ operations = [+ migrations.RunPython(+ set_default_value_for_can_move_messages_within_channel_group,+ elidable=True,+ reverse_code=migrations.RunPython.noop,+ )+ ]diff --git a/zerver/migrations/0721_alter_stream_can_move_messages_within_channel_group.py b/zerver/migrations/0721_alter_stream_can_move_messages_within_channel_group.pynew file mode 100644index 00000000000..3a76cf15a0f--- /dev/null+++ b/zerver/migrations/0721_alter_stream_can_move_messages_within_channel_group.py@@ -0,0 +1,22 @@+# Generated by Django 5.1.8 on 2025-06-05 08:05++import django.db.models.deletion+from django.db import migrations, models+++class Migration(migrations.Migration):+ dependencies = [+ ("zerver", "0720_set_default_value_for_can_move_messages_within_channel_group"),+ ]++ operations = [+ migrations.AlterField(+ model_name="stream",+ name="can_move_messages_within_channel_group",+ field=models.ForeignKey(+ on_delete=django.db.models.deletion.RESTRICT,+ related_name="+",+ to="zerver.usergroup",+ ),+ ),+ ]diff --git a/zerver/models/streams.py b/zerver/models/streams.pyindex 92eaad4945a..a9087a1fa53 100644--- a/zerver/models/streams.py+++ b/zerver/models/streams.py@@ -146,6 +146,9 @@ class Stream(models.Model):can_administer_channel_group = models.ForeignKey(UserGroup, on_delete=models.RESTRICT, related_name="+")+ can_move_messages_within_channel_group = models.ForeignKey(+ UserGroup, on_delete=models.RESTRICT, related_name="+"+ )can_remove_subscribers_group = models.ForeignKey(UserGroup, on_delete=models.RESTRICT)can_send_message_group = models.ForeignKey(UserGroup, on_delete=models.RESTRICT, related_name="+"@@ -175,6 +178,11 @@ class Stream(models.Model):allow_everyone_group=False,default_group_name="stream_creator_or_nobody",),+ "can_move_messages_within_channel_group": GroupPermissionSetting(+ allow_nobody_group=True,+ allow_everyone_group=True,+ default_group_name=SystemGroups.NOBODY,+ ),"can_remove_subscribers_group": GroupPermissionSetting(allow_nobody_group=True,allow_everyone_group=True,@@ -251,6 +259,7 @@ class Stream(models.Model):"subscriber_count","can_add_subscribers_group_id","can_administer_channel_group_id",+ "can_move_messages_within_channel_group_id","can_send_message_group_id","can_remove_subscribers_group_id","can_subscribe_group_id",diff --git a/zerver/openapi/zulip.yaml b/zerver/openapi/zulip.yamlindex 6bda053ed96..41e210f8d5b 100644--- a/zerver/openapi/zulip.yaml+++ b/zerver/openapi/zulip.yaml@@ -11577,6 +11577,8 @@ paths:$ref: "#/components/schemas/CanRemoveSubscribersGroup"can_administer_channel_group:$ref: "#/components/schemas/CanAdministerChannelGroup"+ can_move_messages_within_channel_group:+ $ref: "#/components/schemas/CanMoveMessagesWithinChannelGroup"can_send_message_group:$ref: "#/components/schemas/CanSendMessageGroup"can_subscribe_group:@@ -11619,6 +11621,8 @@ paths:contentType: application/jsoncan_administer_channel_group:contentType: application/json+ can_move_messages_within_channel_group:+ contentType: application/jsoncan_send_message_group:contentType: application/jsoncan_subscribe_group:@@ -16233,6 +16237,7 @@ paths:can_add_subscribers_group: {}can_remove_subscribers_group: {}can_administer_channel_group: {}+ can_move_messages_within_channel_group: {}can_send_message_group: {}can_subscribe_group: {}subscriber_count: {}@@ -21473,6 +21478,7 @@ paths:can_add_subscribers_group: {}can_remove_subscribers_group: {}can_administer_channel_group: {}+ can_move_messages_within_channel_group: {}can_send_message_group: {}can_subscribe_group: {}subscriber_count: {}@@ -21896,6 +21902,32 @@ paths:"old": 15,}- $ref: "#/components/schemas/GroupSettingValueUpdate"+ can_move_messages_within_channel_group:+ allOf:+ - description: |+ The set of users who have permission to move messages within this channel+ expressed as an [update to a group-setting value][update-group-setting].++ [update-group-setting]: /api/group-setting-values#updating-group-setting-values++ Note that a user must [have content access](/help/channel-permissions) to a+ channel in order to move messages within the channel.++ Channel administrators and users present in the organization-level+ `can_move_messages_between_topics_group` setting can always move messages+ within the channel if they [have content access](/help/channel-permissions) to+ the channel.++ **Changes**: New in Zulip 11.0 (feature level 396). Prior to this+ change, only the users in `can_move_messages_between_topics_group` were able+ move messages between topics of a channel.+ example:+ {+ "new":+ {"direct_members": [10], "direct_subgroups": [11]},+ "old": 15,+ }+ - $ref: "#/components/schemas/GroupSettingValueUpdate"can_send_message_group:allOf:- description: |@@ -21961,6 +21993,8 @@ paths:contentType: application/jsoncan_administer_channel_group:contentType: application/json+ can_move_messages_within_channel_group:+ contentType: application/jsoncan_send_message_group:contentType: application/jsoncan_subscribe_group:@@ -23947,6 +23981,7 @@ components:can_add_subscribers_group: {}can_remove_subscribers_group: {}can_administer_channel_group: {}+ can_move_messages_within_channel_group: {}can_send_message_group: {}can_subscribe_group: {}subscriber_count: {}@@ -24142,6 +24177,8 @@ components:$ref: "#/components/schemas/CanRemoveSubscribersGroup"can_administer_channel_group:$ref: "#/components/schemas/CanAdministerChannelGroup"+ can_move_messages_within_channel_group:+ $ref: "#/components/schemas/CanMoveMessagesWithinChannelGroup"can_send_message_group:$ref: "#/components/schemas/CanSendMessageGroup"can_subscribe_group:@@ -25233,6 +25270,8 @@ components:$ref: "#/components/schemas/CanRemoveSubscribersGroup"can_administer_channel_group:$ref: "#/components/schemas/CanAdministerChannelGroup"+ can_move_messages_within_channel_group:+ $ref: "#/components/schemas/CanMoveMessagesWithinChannelGroup"can_send_message_group:$ref: "#/components/schemas/CanSendMessageGroup"can_subscribe_group:@@ -27096,6 +27135,26 @@ components:change, the permission to administer channels was limited to realmadministrators.+ [setting-values]: /api/group-setting-values+ CanMoveMessagesWithinChannelGroup:+ allOf:+ - $ref: "#/components/schemas/GroupSettingValue"+ - description: |+ A [group-setting value][setting-values] defining the set of users+ who have permission to move messages within this channel.++ Note that a user must [have content access](/help/channel-permissions) to a+ channel in order to move messages within the channel.++ Channel administrators and users present in the organization-level+ `can_move_messages_between_topics_group` setting can always move messages+ within the channel if they [have content access](/help/channel-permissions) to+ the channel.++ **Changes**: New in Zulip 11.0 (feature level 396). Prior to this+ change, only the users in `can_move_messages_between_topics_group` were able+ move messages between topics of a channel.+[setting-values]: /api/group-setting-valuesCanSendMessageGroup:allOf:diff --git a/zerver/tests/test_message_edit.py b/zerver/tests/test_message_edit.pyindex d973b150115..8861dec3301 100644--- a/zerver/tests/test_message_edit.py+++ b/zerver/tests/test_message_edit.py@@ -1477,13 +1477,13 @@ class EditMessageTest(ZulipTestCase):)do_edit_message_assert_success(id_, "E", "iago")- # even owners and admins cannot edit the topics of messagesset_message_editing_params(True, "unlimited", nobody_system_group)+ # owners and admins are allowed to edit the topics via channel-level+ # `can_move_messages_within_channel_group` permission+ do_edit_message_assert_success(id_, "H", "desdemona")+ do_edit_message_assert_success(id_, "I", "iago")do_edit_message_assert_error(- id_, "H", "You don't have permission to edit this message", "desdemona"- )- do_edit_message_assert_error(- id_, "H", "You don't have permission to edit this message", "iago"+ id_, "E", "You don't have permission to edit this message", "shiva")# users can edit topics even if allow_message_editing is False@@ -1529,9 +1529,9 @@ class EditMessageTest(ZulipTestCase):# Polonius and Cordelia are in the allowed user group, so can move messages.do_edit_message_assert_success(id_, "I", "polonius")do_edit_message_assert_success(id_, "J", "cordelia")- # Iago is not in the allowed user group, so cannot move messages.+ # Hamlet is not in the allowed user group, so cannot move messages.do_edit_message_assert_error(- id_, "K", "You don't have permission to edit this message", "iago"+ id_, "K", "You don't have permission to edit this message", "hamlet")# Test for checking the setting for anonymous user group.diff --git a/zerver/tests/test_message_move_topic.py b/zerver/tests/test_message_move_topic.pyindex 847d41e9d58..6e8f1418937 100644--- a/zerver/tests/test_message_move_topic.py+++ b/zerver/tests/test_message_move_topic.py@@ -19,6 +19,7 @@ from zerver.actions.realm_settings import (do_change_realm_permission_group_setting,do_set_realm_property,)+from zerver.actions.streams import do_change_stream_group_based_settingfrom zerver.actions.user_groups import check_add_user_groupfrom zerver.actions.user_settings import do_change_user_settingfrom zerver.actions.user_topics import do_set_user_topic_visibility_policy@@ -37,7 +38,7 @@ from zerver.models import Message, UserMessage, UserProfile, UserTopicfrom zerver.models.constants import MAX_TOPIC_NAME_LENGTHfrom zerver.models.groups import NamedUserGroup, SystemGroupsfrom zerver.models.realms import RealmTopicsPolicyEnum-from zerver.models.streams import Stream, StreamTopicsPolicyEnum+from zerver.models.streams import Stream, StreamTopicsPolicyEnum, get_streamfrom zerver.models.users import ResolvedTopicNoticeAutoReadPolicyEnum@@ -46,6 +47,34 @@ class MessageMoveTopicTest(ZulipTestCase):msg = Message.objects.get(id=msg_id)self.assertEqual(msg.topic_name(), topic_name)+ def assert_move_message(+ self,+ user: str,+ orig_stream: Stream,+ stream_id: int | None = None,+ topic_name: str | None = None,+ expected_error: str | None = None,+ ) -> None:+ user_profile = self.example_user(user)+ self.subscribe(user_profile, orig_stream.name)+ message_id = self.send_stream_message(user_profile, orig_stream.name)++ params_dict: dict[str, str | int] = {}+ if stream_id is not None:+ params_dict["stream_id"] = stream_id+ if topic_name is not None:+ params_dict["topic"] = topic_name++ result = self.api_patch(+ user_profile,+ "/api/v1/messages/" + str(message_id),+ params_dict,+ )+ if expected_error is not None:+ self.assert_json_error(result, expected_error)+ else:+ self.assert_json_success(result)+def assert_has_visibility_policy(self,user_profile: UserProfile,@@ -2199,7 +2228,7 @@ class MessageMoveTopicTest(ZulipTestCase):# Do not allow if there is some change other than adding# RESOLVED_TOPIC_PREFIX- self.login_user(admin_user)+ self.login_user(cordelia)result = self.client_patch("/json/messages/" + str(id4),{@@ -2210,7 +2239,7 @@ class MessageMoveTopicTest(ZulipTestCase):self.assert_json_error(result, "You don't have permission to edit this message")result = self.resolve_topic_containing_message(- admin_user,+ cordelia,id4,)self.assert_json_success(result)@@ -2251,3 +2280,119 @@ class MessageMoveTopicTest(ZulipTestCase):id5,)self.assert_json_success(result)++ def test_can_move_messages_within_channel_group(self) -> None:+ hamlet = self.example_user("hamlet")+ cordelia = self.example_user("cordelia")+ iago = self.example_user("iago")+ realm = hamlet.realm++ members_system_group = NamedUserGroup.objects.get(+ name=SystemGroups.MEMBERS, realm=realm, is_system_group=True+ )+ moderators_system_group = NamedUserGroup.objects.get(+ name=SystemGroups.MODERATORS, realm=realm, is_system_group=True+ )+ nobody_system_group = NamedUserGroup.objects.get(+ name=SystemGroups.NOBODY, realm=realm, is_system_group=True+ )++ expected_error = "You don't have permission to edit this message"++ do_change_realm_permission_group_setting(+ realm,+ "can_move_messages_between_topics_group",+ nobody_system_group,+ acting_user=None,+ )+ do_change_realm_permission_group_setting(+ realm,+ "can_move_messages_between_channels_group",+ members_system_group,+ acting_user=None,+ )++ stream_1 = get_stream("Denmark", realm)+ stream_2 = get_stream("Verona", realm)++ # Nobody is allowed to move messages.+ self.assert_move_message(+ "hamlet", stream_1, topic_name="new topic", expected_error=expected_error+ )+ # Realm admin can always move messages within the channel.+ self.assert_move_message("iago", stream_1, topic_name="new topic")++ do_change_stream_group_based_setting(+ stream_1,+ "can_move_messages_within_channel_group",+ members_system_group,+ acting_user=iago,+ )+ # Only members are allowed to move messages within the channel.+ self.assert_move_message("hamlet", stream_1, topic_name="new topic")+ self.assert_move_message("cordelia", stream_1, topic_name="new topic")+ # Guests are not allowed.+ self.assert_move_message(+ "polonius", stream_1, topic_name="new topic", expected_error=expected_error+ )++ # Users are allowed to move messages to different topics out of the channel+ # if they are in `can_move_messages_within_channel_group` permission of either+ # the original channel or the destination channel.+ self.assert_move_message(+ "hamlet",+ stream_1,+ stream_id=stream_2.id,+ topic_name="new topic",+ )+ self.assert_move_message(+ "hamlet",+ stream_2,+ stream_id=stream_1.id,+ topic_name="new topic",+ )++ do_change_stream_group_based_setting(+ stream_1,+ "can_move_messages_within_channel_group",+ moderators_system_group,+ acting_user=iago,+ )+ # Hamlet can't move message to another topic now as he is not in+ # the `can_move_messages_within_channel_group` of either of the channel.+ self.assert_move_message(+ "hamlet",+ stream_1,+ stream_id=stream_2.id,+ topic_name="new topic",+ expected_error=expected_error,+ )+ # But he still can move messages between channel without changing the topic.+ self.assert_move_message(+ "hamlet",+ stream_1,+ stream_id=stream_2.id,+ )++ user_group = check_add_user_group(+ realm, "new_group", [hamlet, cordelia], acting_user=hamlet+ )+ do_change_stream_group_based_setting(+ stream_1, "can_move_messages_within_channel_group", user_group, acting_user=iago+ )++ # Hamlet and Cordelia are in the `can_move_messages_within_channel_group`,+ # so they can move messages within the channel.+ self.assert_move_message("cordelia", stream_1, topic_name="new topic")+ self.assert_move_message("hamlet", stream_1, topic_name="new topic")+ # But Shiva is not, so he can't.+ self.assert_move_message(+ "shiva", stream_1, topic_name="new topic", expected_error=expected_error+ )++ do_change_stream_group_based_setting(+ stream_1, "can_administer_channel_group", members_system_group, acting_user=iago+ )+ # Channel administrators with content access can always move messages within+ # the channel even if they are not in `can_move_messages_within_channel_group`.+ self.assert_move_message("shiva", stream_1, topic_name="new topic")diff --git a/zerver/views/streams.py b/zerver/views/streams.pyindex f5a7f7c57e2..4115a5e2899 100644--- a/zerver/views/streams.py+++ b/zerver/views/streams.py@@ -289,6 +289,7 @@ def update_stream_backend(] = None,can_add_subscribers_group: Json[GroupSettingChangeRequest] | None = None,can_administer_channel_group: Json[GroupSettingChangeRequest] | None = None,+ can_move_messages_within_channel_group: Json[GroupSettingChangeRequest] | None = None,can_send_message_group: Json[GroupSettingChangeRequest] | None = None,can_remove_subscribers_group: Json[GroupSettingChangeRequest] | None = None,can_subscribe_group: Json[GroupSettingChangeRequest] | None = None,@@ -659,6 +660,7 @@ def add_subscriptions_backend(] = None,can_add_subscribers_group: Json[int | UserGroupMembersData] | None = None,can_administer_channel_group: Json[int | UserGroupMembersData] | None = None,+ can_move_messages_within_channel_group: Json[int | UserGroupMembersData] | None = None,can_send_message_group: Json[int | UserGroupMembersData] | None = None,can_remove_subscribers_group: Json[int | UserGroupMembersData] | None = None,can_subscribe_group: Json[int | UserGroupMembersData] | None = None,@@ -746,6 +748,9 @@ def add_subscriptions_backend(stream_dict_copy["can_administer_channel_group"] = group_settings_map["can_administer_channel_group"]+ stream_dict_copy["can_move_messages_within_channel_group"] = group_settings_map[+ "can_move_messages_within_channel_group"+ ]stream_dict_copy["can_send_message_group"] = group_settings_map["can_send_message_group"]stream_dict_copy["can_remove_subscribers_group"] = group_settings_map["can_remove_subscribers_group"