popup_banners: Update connection error banner label.

This commit updates the connection error banner label to
"Unable to connect to Zulip. Trying to reconnect soon…" when the user
manually retries the connection via the "Try now" button and when the
retry time is less than 5 seconds. And updates the countdown label of
the same banner to "Unable to connect to Zulip. Trying to reconnect in
{retry_delay_secs} seconds…".
This commit is contained in:
Sayam Samal
2025-03-21 20:26:54 +05:30
committed by Tim Abbott
parent 70e36ef16a
commit 3701c99b0a

View File

@@ -21,14 +21,14 @@ function fade_out_popup_banner($banner: JQuery): void {
const get_connection_error_label = (retry_delay_secs: number): string => {
if (original_retry_delay_secs < 5) {
// When the retry delay is less than 5 seconds, we don't show the retry
// delay time in the banner, and instead just show "Retrying soon…" to
// constant flickering of the banner label for very short times.
return $t({defaultMessage: "Unable to connect to Zulip. Retrying soon…"});
// delay time in the banner, and instead just show "Trying to reconnect soon…"
// to avoid constant flickering of the banner label for very short times.
return $t({defaultMessage: "Unable to connect to Zulip. Trying to reconnect soon…"});
}
return $t(
{
defaultMessage:
"Unable to connect to Zulip. {retry_delay_secs, plural, one {Trying again in {retry_delay_secs} second…} other {Trying again in {retry_delay_secs} seconds…}}",
"Unable to connect to Zulip. {retry_delay_secs, plural, one {Trying to reconnect in {retry_delay_secs} second…} other {Trying to reconnect in {retry_delay_secs} seconds…}}",
},
{retry_delay_secs},
);
@@ -139,7 +139,7 @@ function retry_connection_click_handler(e: JQuery.ClickEvent, on_retry_callback:
const $banner = $(e.currentTarget).closest(".banner");
$banner
.find(".banner-label")
.text($t({defaultMessage: "Unable to connect to Zulip. Retrying now…"}));
.text($t({defaultMessage: "Unable to connect to Zulip. Trying to reconnect soon…"}));
const $button = $(e.currentTarget).closest(".retry-connection");