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: Use Uppy's "onBeforeFileAdded" to allow duplicate file uploads.

Alex Vandiver3f00d3d493f8
diff --git a/web/src/upload.ts b/web/src/upload.ts
index 0947bacf8a9..2ee09c7eb87 100644
--- a/web/src/upload.ts
+++ b/web/src/upload.ts
@@ -139,7 +139,7 @@ export let hide_upload_banner = (
config.upload_banner(file_id).remove();
}
- if (uppy.getFiles().length === 0) {
+ if (uppy.getFiles().every((e) => e.progress.uploadComplete)) {
if (config.mode === "compose") {
compose_validate.set_upload_in_progress(false);
} else {
@@ -286,6 +286,7 @@ export function setup_upload(config: Config): Uppy {
},
pluralize: (_n) => 0,
},
+ onBeforeFileAdded: () => true, // Allow duplicate file uploads
});
uppy.use(Tus, {
// https://uppy.io/docs/tus/#options
@@ -421,9 +422,6 @@ export function setup_upload(config: Config): Uppy {
compose_ui.autosize_textarea($text_area);
- // The uploaded files should be removed since uppy doesn't allow files in the store
- // to be re-uploaded again.
- uppy.removeFile(file.id);
// Hide upload status after waiting 100ms after the 1s transition to 100%
// so that the user can see the progress bar at 100%.
hide_upload_banner(uppy, config, file.id, 1100);