mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 13:33:24 +00:00
upload: Don't add remaining files if adding a file fails.
If a file cannot be added for upload because of restrictions in frontend we call cancelAll immediately in 'info-visible' callback. This would prevent files that are already added to be cancelled but does not cancel files that are yet to be added. So we use break to prevent any more files from being added.
This commit is contained in:
@@ -146,7 +146,7 @@ run_test('show_error_message', () => {
|
||||
|
||||
run_test('upload_files', () => {
|
||||
let uppy_cancel_all_called = false;
|
||||
const files = [
|
||||
let files = [
|
||||
{
|
||||
name: "budapest.png",
|
||||
type: "image/png",
|
||||
@@ -212,6 +212,25 @@ run_test('upload_files', () => {
|
||||
assert(compose_ui_autosize_textarea_called);
|
||||
assert(uppy_add_file_called);
|
||||
|
||||
files = [
|
||||
{
|
||||
name: "budapest.png",
|
||||
type: "image/png",
|
||||
},
|
||||
{
|
||||
name: "prague.png",
|
||||
type: "image/png",
|
||||
},
|
||||
];
|
||||
let add_file_counter = 0;
|
||||
uppy.addFile = (file) => {
|
||||
assert.equal(file.name, "budapest.png");
|
||||
add_file_counter += 1;
|
||||
throw Error();
|
||||
};
|
||||
upload.upload_files(uppy, config, files);
|
||||
assert.equal(add_file_counter, 1);
|
||||
|
||||
global.patch_builtin("setTimeout", (func) => {
|
||||
func();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user