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.

upload: Clear stale upload error banners on a new upload.

Shubham Padia989a9856e1b4
diff --git a/web/src/upload.ts b/web/src/upload.ts
index 768a57fa477..e884691ddb5 100644
--- a/web/src/upload.ts
+++ b/web/src/upload.ts
@@ -278,6 +278,11 @@ export let upload_files = (
if (files.length === 0) {
return;
}
+
+ // A new upload attempt supersedes any error banner (e.g. "file too
+ // large") left over from a previous attempt, so we clear those here.
+ config.banner_container().find(".upload_banner.error").remove();
+
if (realm.max_file_upload_size_mib === 0) {
show_error_message(
config,
diff --git a/web/tests/lib/compose_banner.cjs b/web/tests/lib/compose_banner.cjs
index 06990c92245..7f3a09e70ce 100644
--- a/web/tests/lib/compose_banner.cjs
+++ b/web/tests/lib/compose_banner.cjs
@@ -26,6 +26,7 @@ exports.mock_banners = () => {
const $cb = $("#compose_banners");
$cb.set_closest_results(".edit_form_banners", $.create("edit-form-banners-stub"));
+ $cb.set_find_results(".upload_banner.error", $stub);
$cb.set_find_results(".no_post_permissions", $stub);
$cb.set_find_results(".message_too_long", $stub);
$cb.set_find_results(".wildcards_not_allowed", $stub);