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: Suppress warnings only for the container with an error.

Pritesh Shetty1a38989cef1b
diff --git a/web/src/compose_banner.ts b/web/src/compose_banner.ts
index c1d4af54e59..cfdb4380348 100644
--- a/web/src/compose_banner.ts
+++ b/web/src/compose_banner.ts
@@ -83,7 +83,10 @@ export function append_compose_banner_to_banner_list(
$banner: JQuery,
$list_container: JQuery,
): boolean {
- if ($banner.hasClass("warning") && has_error()) {
+ // Suppress a warning only when its own container already shows an
+ // error; an error elsewhere (e.g. the compose box) must not hide a
+ // warning targeting a different container.
+ if ($banner.hasClass("warning") && has_error($list_container)) {
return false;
}
scroll_util.get_content_element($list_container).append($banner);
@@ -311,8 +314,8 @@ export function show_unknown_zoom_user_error(email: string): void {
append_compose_banner_to_banner_list($(new_row_html), $("#compose_banners"));
}
-export function has_error(): boolean {
- return $("#compose_banners .error").length > 0;
+export function has_error($list_container: JQuery): boolean {
+ return $list_container.find(`.${CSS.escape(ERROR)}`).length > 0;
}
export function show_convert_pasted_text_to_file_banner({