mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-03 21:43:21 +00:00 
			
		
		
		
	web-stream-create: Update frontend errors for stream rename channel.
Updates translated error and warning strings when creating a new stream in the web app to use channel instead of stream. Part of stream to channel rename project.
This commit is contained in:
		
				
					committed by
					
						
						Tim Abbott
					
				
			
			
				
	
			
			
			
						parent
						
							13299577da
						
					
				
				
					commit
					ba766a564a
				
			@@ -115,13 +115,13 @@ async function test_streams_with_empty_names_cannot_be_created(page: Page): Prom
 | 
			
		||||
    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");
 | 
			
		||||
    assert.strictEqual(await stream_name_error(page), "Choose a name for the new stream.");
 | 
			
		||||
    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");
 | 
			
		||||
    assert.strictEqual(await stream_name_error(page), "A stream with this name already exists.");
 | 
			
		||||
    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";
 | 
			
		||||
    await page.click(cancel_button_selector);
 | 
			
		||||
 
 | 
			
		||||
@@ -42,7 +42,7 @@ export function should_show_first_stream_created_modal() {
 | 
			
		||||
class StreamSubscriptionError {
 | 
			
		||||
    report_no_subs_to_stream() {
 | 
			
		||||
        $("#stream_subscription_error").text(
 | 
			
		||||
            $t({defaultMessage: "You cannot create a stream with no subscribers."}),
 | 
			
		||||
            $t({defaultMessage: "You cannot create a channel with no subscribers."}),
 | 
			
		||||
        );
 | 
			
		||||
        $("#stream_subscription_error").show();
 | 
			
		||||
    }
 | 
			
		||||
@@ -51,7 +51,7 @@ class StreamSubscriptionError {
 | 
			
		||||
        $("#stream_subscription_error").text(
 | 
			
		||||
            $t({
 | 
			
		||||
                defaultMessage:
 | 
			
		||||
                    "You must be an organization administrator to create a stream without subscribing.",
 | 
			
		||||
                    "You must be an organization administrator to create a channel without subscribing.",
 | 
			
		||||
            }),
 | 
			
		||||
        );
 | 
			
		||||
        $("#stream_subscription_error").show();
 | 
			
		||||
@@ -66,7 +66,7 @@ const stream_subscription_error = new StreamSubscriptionError();
 | 
			
		||||
class StreamNameError {
 | 
			
		||||
    report_already_exists() {
 | 
			
		||||
        $("#stream_name_error").text(
 | 
			
		||||
            $t({defaultMessage: "A stream with this name already exists."}),
 | 
			
		||||
            $t({defaultMessage: "A channel with this name already exists."}),
 | 
			
		||||
        );
 | 
			
		||||
        $("#stream_name_error").show();
 | 
			
		||||
    }
 | 
			
		||||
@@ -76,7 +76,7 @@ class StreamNameError {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    report_empty_stream() {
 | 
			
		||||
        $("#stream_name_error").text($t({defaultMessage: "Choose a name for the new stream."}));
 | 
			
		||||
        $("#stream_name_error").text($t({defaultMessage: "Choose a name for the new channel."}));
 | 
			
		||||
        $("#stream_name_error").show();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -176,7 +176,7 @@ function create_stream() {
 | 
			
		||||
    // and paste over a description with newline characters in it. Prevent that.
 | 
			
		||||
    if (description.includes("\n")) {
 | 
			
		||||
        ui_report.client_error(
 | 
			
		||||
            $t_html({defaultMessage: "The stream description cannot contain newline characters."}),
 | 
			
		||||
            $t_html({defaultMessage: "The channel description cannot contain newline characters."}),
 | 
			
		||||
            $(".stream_create_info"),
 | 
			
		||||
        );
 | 
			
		||||
        return undefined;
 | 
			
		||||
@@ -269,7 +269,7 @@ function create_stream() {
 | 
			
		||||
    data.can_remove_subscribers_group = can_remove_subscribers_group_id;
 | 
			
		||||
 | 
			
		||||
    loading.make_indicator($("#stream_creating_indicator"), {
 | 
			
		||||
        text: $t({defaultMessage: "Creating stream..."}),
 | 
			
		||||
        text: $t({defaultMessage: "Creating channel..."}),
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    // Subscribe yourself and possible other people to a new stream.
 | 
			
		||||
@@ -280,7 +280,7 @@ function create_stream() {
 | 
			
		||||
            $("#create_stream_name").val("");
 | 
			
		||||
            $("#create_stream_description").val("");
 | 
			
		||||
            ui_report.success(
 | 
			
		||||
                $t_html({defaultMessage: "Stream successfully created!"}),
 | 
			
		||||
                $t_html({defaultMessage: "Channel successfully created!"}),
 | 
			
		||||
                $(".stream_create_info"),
 | 
			
		||||
            );
 | 
			
		||||
            loading.destroy_indicator($("#stream_creating_indicator"));
 | 
			
		||||
@@ -295,13 +295,13 @@ function create_stream() {
 | 
			
		||||
                // parsing the error string, so it works correctly
 | 
			
		||||
                // with i18n.  And likely we should be reporting the
 | 
			
		||||
                // error text directly rather than turning it into
 | 
			
		||||
                // "Error creating stream"?
 | 
			
		||||
                // "Error creating channel"?
 | 
			
		||||
                stream_name_error.report_already_exists();
 | 
			
		||||
                stream_name_error.select();
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            ui_report.error(
 | 
			
		||||
                $t_html({defaultMessage: "Error creating stream"}),
 | 
			
		||||
                $t_html({defaultMessage: "Error creating channel"}),
 | 
			
		||||
                xhr,
 | 
			
		||||
                $(".stream_create_info"),
 | 
			
		||||
            );
 | 
			
		||||
@@ -428,7 +428,7 @@ export function set_up_handlers() {
 | 
			
		||||
 | 
			
		||||
        if (principals.length >= 50) {
 | 
			
		||||
            const html_body = render_subscription_invites_warning_modal({
 | 
			
		||||
                stream_name,
 | 
			
		||||
                channel_name: stream_name,
 | 
			
		||||
                count: principals.length,
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,3 +1,3 @@
 | 
			
		||||
<p>
 | 
			
		||||
    {{t "Are you sure you want to create stream ''''{stream_name}'''' and subscribe {count} users to it?" }}
 | 
			
		||||
    {{t "Are you sure you want to create channel ''''{channel_name}'''' and subscribe {count} users to it?" }}
 | 
			
		||||
</p>
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user