Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

compose-banner: Remove existing not subscribed banners.

Sahil Batra5ac25607ddcf
diff --git a/web/src/compose_banner.ts b/web/src/compose_banner.ts
index 74dbe6f9576..dfb77596024 100644
--- a/web/src/compose_banner.ts
+++ b/web/src/compose_banner.ts
@@ -259,10 +259,9 @@ export function show_stream_not_subscribed_error(
sub: StreamSubscription,
banner_text: string,
): void {
- const $banner_container = $("#compose_banners");
- if ($(`#compose_banners .${CSS.escape(CLASSNAMES.user_not_subscribed)}`).length > 0) {
- return;
- }
+ // Remove any existing banners with this warning.
+ $(`#compose_banners .${CSS.escape(CLASSNAMES.user_not_subscribed)}`).remove();
+
const new_row_html = render_compose_banner({
banner_type: ERROR,
banner_text,
@@ -274,7 +273,7 @@ export function show_stream_not_subscribed_error(
// closing the banner would be more confusing than helpful.
hide_close_button: true,
});
- append_compose_banner_to_banner_list($(new_row_html), $banner_container);
+ append_compose_banner_to_banner_list($(new_row_html), $("#compose_banners"));
}
export function show_unknown_zoom_user_error(email: string): void {