mirror of https://github.com/zulip/zulip.git
file uploads: Remove status text for user cancelled uploads.
Remove the 'Uploading file...' message from the compose box when the user manually cancels a file upload.
This commit is contained in:
parent
4215386ae3
commit
b30da07fd3
|
@ -164,6 +164,7 @@ run_test('upload_files', () => {
|
|||
assert.equal(params.type, "image/png");
|
||||
assert.equal(params.data, files[0]);
|
||||
},
|
||||
getFiles: () => [...files],
|
||||
};
|
||||
let hide_upload_status_called = false;
|
||||
upload.hide_upload_status = (config) => {
|
||||
|
@ -236,9 +237,32 @@ run_test('upload_files', () => {
|
|||
});
|
||||
hide_upload_status_called = false;
|
||||
uppy_cancel_all_called = false;
|
||||
let compose_ui_replace_syntax_called = false;
|
||||
files = [
|
||||
{
|
||||
name: "budapest.png",
|
||||
type: "image/png",
|
||||
},
|
||||
];
|
||||
compose_ui.replace_syntax = (old_syntax, new_syntax, textarea) => {
|
||||
compose_ui_replace_syntax_called = true;
|
||||
assert.equal(old_syntax, "[Uploading budapest.png…]()");
|
||||
assert.equal(new_syntax, "");
|
||||
assert.equal(textarea, $('#compose-textarea'));
|
||||
};
|
||||
on_click_close_button_callback();
|
||||
assert(uppy_cancel_all_called);
|
||||
assert(hide_upload_status_called);
|
||||
assert(compose_ui_autosize_textarea_called);
|
||||
assert(compose_ui_replace_syntax_called);
|
||||
hide_upload_status_called = false;
|
||||
compose_ui_replace_syntax_called = false;
|
||||
$('#compose-textarea').val("user modified text");
|
||||
on_click_close_button_callback();
|
||||
assert(hide_upload_status_called);
|
||||
assert(compose_ui_autosize_textarea_called);
|
||||
assert(compose_ui_replace_syntax_called);
|
||||
assert($('#compose-textarea').val(), "user modified text");
|
||||
});
|
||||
|
||||
run_test('uppy_config', () => {
|
||||
|
|
|
@ -101,7 +101,12 @@ exports.upload_files = function (uppy, config, files) {
|
|||
exports.get_item("send_status", config).addClass("alert-info").removeClass("alert-error").show();
|
||||
exports.get_item("send_status_message", config).html($("<p>").text(i18n.t("Uploading…")));
|
||||
exports.get_item("send_status_close_button", config).one('click', function () {
|
||||
uppy.getFiles().forEach((file) => {
|
||||
compose_ui.replace_syntax("[Uploading " + file.name + "…]()", "", exports.get_item("textarea", config));
|
||||
});
|
||||
compose_ui.autosize_textarea();
|
||||
uppy.cancelAll();
|
||||
exports.get_item("textarea", config).focus();
|
||||
setTimeout(function () {
|
||||
exports.hide_upload_status(config);
|
||||
}, 500);
|
||||
|
|
Loading…
Reference in New Issue