Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
stream: Add UI to set can_remove_subscribers_group when creating stream.
Sahil Batra89f39a8aede8
diff --git a/static/js/stream_create.js b/static/js/stream_create.jsindex ac300a85252..00b6133d1d0 100644--- a/static/js/stream_create.js+++ b/static/js/stream_create.js@@ -245,6 +245,12 @@ function create_stream() {const user_ids = stream_create_subscribers.get_principals();data.principals = JSON.stringify(user_ids);+ const can_remove_subscribers_group_id = Number.parseInt(+ stream_settings_ui.new_stream_can_remove_subscribers_group_widget.value(),+ 10,+ );+ data.can_remove_subscribers_group_id = can_remove_subscribers_group_id;+loading.make_indicator($("#stream_creating_indicator"), {text: $t({defaultMessage: "Creating stream..."}),});@@ -421,4 +427,6 @@ export function set_up_handlers() {e.preventDefault();}});++ stream_settings_ui.new_stream_can_remove_subscribers_group_widget.setup();}diff --git a/static/js/stream_settings_ui.js b/static/js/stream_settings_ui.jsindex 0ce41ba24a0..43133150d18 100644--- a/static/js/stream_settings_ui.js+++ b/static/js/stream_settings_ui.js@@ -14,6 +14,7 @@ import * as channel from "./channel";import * as components from "./components";import * as compose_state from "./compose_state";import * as confirm_dialog from "./confirm_dialog";+import {DropdownListWidget} from "./dropdown_list_widget";import * as hash_util from "./hash_util";import {$t, $t_html} from "./i18n";import * as keydown_util from "./keydown_util";@@ -39,6 +40,7 @@ import * as stream_ui_updates from "./stream_ui_updates";import * as sub_store from "./sub_store";import * as ui from "./ui";import * as ui_report from "./ui_report";+import * as user_groups from "./user_groups";import * as util from "./util";export function set_right_panel_title(sub) {@@ -549,6 +551,8 @@ export function switch_stream_sort(tab_name) {redraw_left_panel();}+export let new_stream_can_remove_subscribers_group_widget = null;+export function setup_page(callback) {// We should strongly consider only setting up the page once,// but I am writing these comments write before a big release,@@ -624,6 +628,15 @@ export function setup_page(callback) {function populate_and_fill() {$("#manage_streams_container").empty();+ const opts = {+ widget_name: "new_stream_can_remove_subscribers_group_id",+ data: user_groups.get_realm_user_groups_for_dropdown_list_widget(true, true),+ default_text: $t({defaultMessage: "No user groups"}),+ include_current_item: false,+ value: user_groups.get_user_group_from_name("@role:administrators").id,+ };+ new_stream_can_remove_subscribers_group_widget = new DropdownListWidget(opts);+// TODO: Ideally we'd indicate in some way what stream types// the user can create, by showing other options as disabled.const stream_privacy_policy = stream_data.stream_privacy_policy_values.public.code;diff --git a/static/templates/stream_settings/stream_creation_form.hbs b/static/templates/stream_settings/stream_creation_form.hbsindex 377a87fb072..42092768bc2 100644--- a/static/templates/stream_settings/stream_creation_form.hbs+++ b/static/templates/stream_settings/stream_creation_form.hbs@@ -24,7 +24,8 @@<div class="stream-types">{{> stream_typesstream_post_policy=stream_post_policy_values.everyone.code- is_stream_edit=false }}+ is_stream_edit=false+ can_remove_subscribers_setting_widget_name="new_stream_can_remove_subscribers_group_id" }}</div></section><section class="block">diff --git a/static/templates/stream_settings/stream_settings.hbs b/static/templates/stream_settings/stream_settings.hbsindex 6e5ef9c50a5..9bfbfb46c0e 100644--- a/static/templates/stream_settings/stream_settings.hbs+++ b/static/templates/stream_settings/stream_settings.hbs@@ -60,7 +60,8 @@upgrade_text_for_wide_organization_logo=../upgrade_text_for_wide_organization_logois_business_type_org=../is_business_type_orgorg_level_message_retention_setting=../org_level_message_retention_setting- is_stream_edit=true }}+ is_stream_edit=true+ can_remove_subscribers_setting_widget_name="can_remove_subscribers_group_id" }}</div>{{/with}}<div class="stream-email-box" {{#unless sub.email_address}}style="display: none;"{{/unless}}>diff --git a/static/templates/stream_settings/stream_types.hbs b/static/templates/stream_settings/stream_types.hbsindex dab5a43ffce..5afae0a2c91 100644--- a/static/templates/stream_settings/stream_types.hbs+++ b/static/templates/stream_settings/stream_types.hbs@@ -40,16 +40,14 @@</select></div>-{{#if is_stream_edit}}<div class="input-group new-style"><label class="dropdown-title">{{t 'Who can unsubscribe others from this stream?'}}</label>{{> ../settings/dropdown_list_widget- widget_name="can_remove_subscribers_group_id"+ widget_name=can_remove_subscribers_setting_widget_namelist_placeholder=(t 'Filter roles')value_type="number" }}</div>-{{/if}}{{#if (or is_owner is_stream_edit)}}<div>