Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
stream_settings: Move "Choose subscribers" into a separate second panel.
sujal279e9d1dc378
diff --git a/web/e2e-tests/stream_create.test.ts b/web/e2e-tests/stream_create.test.tsindex 8a0ccfa5fb8..78a7bf73581 100644--- a/web/e2e-tests/stream_create.test.ts+++ b/web/e2e-tests/stream_create.test.ts@@ -36,6 +36,8 @@ async function stream_name_error(page: Page): Promise<string> {async function click_create_new_stream(page: Page): Promise<void> {await page.click("#add_new_subscription .create_stream_button");+ await page.type("#create_stream_name", "Test Stream 1");+ await page.click("#stream_creation_go_to_subscribers");await page.waitForSelector(".finalize_create_stream", {visible: true});// sanity check that desdemona is the initial subsscriber@@ -78,11 +80,17 @@ async function test_user_filter_ui(page: Page): Promise<void> {}async function create_stream(page: Page): Promise<void> {- await page.waitForSelector('xpath///*[text()="Create channel"]', {visible: true});+ await page.click("#stream_creation_go_to_configure_channel_settings");+ await page.waitForSelector('xpath///*[text()="Configure new channel settings"]', {+ visible: true,+ });+await common.fill_form(page, "form#stream_creation_form", {stream_name: "Puppeteer",stream_description: "Everything Puppeteer",});+ await page.click("#stream_creation_go_to_subscribers");+ await page.type("#create_stream_name", "Test Stream 2");await page.click("form#stream_creation_form .finalize_create_stream");// an explanatory modal is shown for the first stream createdawait common.wait_for_micromodal_to_open(page);@@ -117,16 +125,16 @@ async function test_streams_with_empty_names_cannot_be_created(page: Page): Promawait page.click("#add_new_subscription .create_stream_button");await page.waitForSelector("form#stream_creation_form", {visible: true});await common.fill_form(page, "form#stream_creation_form", {stream_name: " "});- await page.click("form#stream_creation_form button.finalize_create_stream");+ await page.click("form#stream_creation_form button#stream_creation_go_to_subscribers");assert.strictEqual(await stream_name_error(page), "Choose a name for the new channel.");}async function test_streams_with_duplicate_names_cannot_be_created(page: Page): Promise<void> {await common.fill_form(page, "form#stream_creation_form", {stream_name: "Puppeteer"});- await page.click("form#stream_creation_form button.finalize_create_stream");+ await page.click("form#stream_creation_form button#stream_creation_go_to_subscribers");assert.strictEqual(await stream_name_error(page), "A channel with this name already exists.");- const cancel_button_selector = "form#stream_creation_form button.button.white";+ const cancel_button_selector = "form#stream_creation_form button.create_stream_cancel";await page.click(cancel_button_selector);}diff --git a/web/src/stream_create.js b/web/src/stream_create.jsindex 89dc138a316..f86fb7ce65f 100644--- a/web/src/stream_create.js+++ b/web/src/stream_create.js@@ -139,6 +139,42 @@ function toggle_advanced_configurations() {}}+$("body").on("click", ".settings-sticky-footer #stream_creation_go_to_subscribers", (e) => {+ e.preventDefault();+ e.stopPropagation();++ const stream_name = $("#create_stream_name").val().trim();+ const is_stream_name_valid = stream_name_error.validate_for_submit(stream_name);+ const privacy_type = $("#stream_creation_form input[type=radio][name=privacy]:checked").val();+ let invite_only = false;+ let is_web_public = false;++ if (is_stream_name_valid) {+ if (privacy_type === "invite-only" || privacy_type === "invite-only-public-history") {+ invite_only = true;+ } else if (privacy_type === "web-public") {+ is_web_public = true;+ }++ const sub = {+ name: stream_name,+ invite_only,+ is_web_public,+ };+ stream_settings_components.show_subs_pane.create_stream("subscribers_container", sub);+ }+});++$("body").on(+ "click",+ ".settings-sticky-footer #stream_creation_go_to_configure_channel_settings",+ (e) => {+ e.preventDefault();+ e.stopPropagation();+ stream_settings_components.show_subs_pane.create_stream("configure_channel_settings");+ },+);+$("body").on("click", ".advanced-configurations-container .advance-config-title-container", (e) => {e.stopPropagation();toggle_advanced_configurations();@@ -435,6 +471,7 @@ export function set_up_handlers() {const name_ok = stream_name_error.validate_for_submit(stream_name);if (!name_ok) {+ stream_settings_components.show_subs_pane.create_stream("configure_channel_settings");return;}diff --git a/web/src/stream_settings_components.js b/web/src/stream_settings_components.jsindex d32888e29b1..2142bcf6753 100644--- a/web/src/stream_settings_components.js+++ b/web/src/stream_settings_components.js@@ -45,13 +45,36 @@ export const show_subs_pane = {$(".settings").show();set_right_panel_title(sub);},- create_stream() {+ create_stream(container_name = "configure_channel_settings", sub) {+ $(".stream_creation_container").hide();+ if (container_name === "configure_channel_settings") {+ $("#subscription_overlay .stream-info-title").text(+ $t({defaultMessage: "Configure new channel settings"}),+ );+ } else {+ $("#subscription_overlay .stream-info-title").html(render_selected_stream_title({sub}));+ }+ update_footer_buttons(container_name);+ $(`.${container_name}`).show();$(".nothing-selected, .settings, #stream-creation").hide();$("#stream-creation").show();- $("#subscription_overlay .stream-info-title").text($t({defaultMessage: "Create channel"}));},};+export function update_footer_buttons(container_name) {+ if (container_name === "subscribers_container") {+ // Hide stream creation containers and show add subscriber container+ $(".finalize_create_stream").show();+ $("#stream_creation_go_to_subscribers").hide();+ $("#stream_creation_go_to_configure_channel_settings").show();+ } else {+ // Hide add subscriber container and show stream creation containers+ $(".finalize_create_stream").hide();+ $("#stream_creation_go_to_subscribers").show();+ $("#stream_creation_go_to_configure_channel_settings").hide();+ }+}+export function get_active_data() {const $active_row = $("div.stream-row.active");const valid_active_id = Number.parseInt($active_row.attr("data-stream-id"), 10);diff --git a/web/styles/subscriptions.css b/web/styles/subscriptions.cssindex 96f685dc1ce..55ef7040340 100644--- a/web/styles/subscriptions.css+++ b/web/styles/subscriptions.css@@ -703,6 +703,13 @@ h4.user_group_setting_subsection_title {#groups_overlay,#subscription_overlay {+ #stream-creation {+ .settings-sticky-footer {+ display: flex;+ justify-content: space-between;+ }+ }+#user-group-creation,#stream-creation {overflow: auto;diff --git a/web/templates/stream_settings/selected_stream_title.hbs b/web/templates/stream_settings/selected_stream_title.hbsindex 0b9405a9e3e..ac292053fb3 100644--- a/web/templates/stream_settings/selected_stream_title.hbs+++ b/web/templates/stream_settings/selected_stream_title.hbs@@ -1,6 +1,7 @@<a {{#if preview_url}}class="tippy-zulip-delayed-tooltip" data-tooltip-template-id="view-stream-tooltip-template" data-tippy-placement="top" href="{{preview_url}}{{/if}}">- {{> stream_privacy_icon- invite_only=sub.invite_only- is_web_public=sub.is_web_public }}- <span class="stream-name-title">{{sub.name}}</span>+{{#unless preview_url}}{{t "Add subscribers to "}}{{/unless}}+{{> stream_privacy_icon+ invite_only=sub.invite_only+ is_web_public=sub.is_web_public }}+<span class="stream-name-title">{{sub.name}}</span></a>diff --git a/web/templates/stream_settings/stream_creation_form.hbs b/web/templates/stream_settings/stream_creation_form.hbsindex bb252f90f82..73dace9412e 100644--- a/web/templates/stream_settings/stream_creation_form.hbs+++ b/web/templates/stream_settings/stream_creation_form.hbs@@ -5,42 +5,52 @@<div class="alert stream_create_info"></div><div id="stream_creating_indicator"></div><div class="stream-creation-body">- <section class="block">- <label for="create_stream_name" class="settings-field-label">- {{t "Channel name" }}- </label>- <input type="text" name="stream_name" id="create_stream_name" class="settings_text_input"- placeholder="{{t 'Channel name' }}" value="" autocomplete="off" maxlength="{{ max_stream_name_length }}" />- <div id="stream_name_error" class="stream_creation_error"></div>- </section>- <section class="block">- <label for="create_stream_description" class="settings-field-label">- {{t "Channel description" }}- {{> ../help_link_widget link="/help/change-the-channel-description" }}- </label>- <input type="text" name="stream_description" id="create_stream_description" class="settings_text_input"- placeholder="{{t 'Channel description' }}" value="" autocomplete="off" maxlength="{{ max_stream_description_length }}" />- </section>- <section class="block" id="make-invite-only">- <div class="stream-types">- {{> stream_types- stream_post_policy=stream_post_policy_values.everyone.code- is_stream_edit=false- can_remove_subscribers_setting_widget_name="new_stream_can_remove_subscribers_group" }}- </div>- </section>- <section class="block">- <label for="people_to_add">- <h4 class="stream_setting_subsection_title">{{t "Choose subscribers" }}</h4>- </label>- <div id="stream_subscription_error" class="stream_creation_error"></div>- <div class="controls" id="people_to_add"></div>- </section>+ <div class="configure_channel_settings stream_creation_container">+ <section class="block create_stream_title_container">+ <label for="create_stream_name">+ {{t "Channel name" }}+ </label>+ <input type="text" name="stream_name" id="create_stream_name" class="settings_text_input"+ placeholder="{{t 'Channel name' }}" value="" autocomplete="off" maxlength="{{ max_stream_name_length }}" />+ <div id="stream_name_error" class="stream_creation_error"></div>+ </section>+ <section class="block create_stream_description_container">+ <label for="create_stream_description" class="settings-field-label">+ {{t "Channel description" }}+ {{> ../help_link_widget link="/help/change-the-channel-description" }}+ </label>+ <input type="text" name="stream_description" id="create_stream_description" class="settings_text_input"+ placeholder="{{t 'Channel description' }}" value="" autocomplete="off" maxlength="{{ max_stream_description_length }}" />+ </section>+ <section class="block create_stream_types_container" id="make-invite-only">+ <div class="stream-types">+ {{> stream_types+ stream_post_policy=stream_post_policy_values.everyone.code+ is_stream_edit=false+ can_remove_subscribers_setting_widget_name="new_stream_can_remove_subscribers_group" }}+ </div>+ </section>+ </div>+ <div class="subscribers_container stream_creation_container">+ <section class="block stream_create_add_subscriber_container">+ <label for="people_to_add">+ <h4 class="stream_setting_subsection_title">{{t "Choose subscribers" }}</h4>+ </label>+ <div id="stream_subscription_error" class="stream_creation_error"></div>+ <div class="controls" id="people_to_add"></div>+ </section>+ </div></div></div><div class="settings-sticky-footer">- <button class="button small white rounded" data-dismiss="modal">{{t "Cancel" }}</button>- <button class="finalize_create_stream button small sea-green rounded" type="submit">{{t "Create" }}</button>+ <div class="settings-sticky-footer-left">+ <button id="stream_creation_go_to_configure_channel_settings" class="button small sea-green rounded hide">{{t "Back to settings" }}</button>+ </div>+ <div class="settings-sticky-footer-right">+ <button class="create_stream_cancel button small white rounded" data-dismiss="modal">{{t "Cancel" }}</button>+ <button class="finalize_create_stream button small sea-green rounded hide" type="submit">{{t "Create" }}</button>+ <button id="stream_creation_go_to_subscribers" class="button small sea-green rounded">{{t "Continue to add subscribers" }}</button>+ </div></div></form></div>