mirror of https://github.com/zulip/zulip.git
compose_banners: Hide upload progress banner on error.
This commit is contained in:
parent
d887fb57e7
commit
eea59e2edc
|
@ -406,6 +406,8 @@ export function setup_upload(config) {
|
|||
|
||||
uppy.on("upload-error", (file, _error, response) => {
|
||||
const message = response ? response.body.msg : undefined;
|
||||
// Hide the upload status banner on error so only the error banner shows
|
||||
hide_upload_banner(uppy, config, file.id);
|
||||
show_error_message(config, message, file.id);
|
||||
compose_ui.replace_syntax(get_translated_status(file), "", get_item("textarea", config));
|
||||
compose_ui.autosize_textarea(get_item("textarea", config));
|
||||
|
|
|
@ -612,6 +612,12 @@ test("uppy_events", ({override_rewire, mock_template}) => {
|
|||
};
|
||||
on_info_visible_callback();
|
||||
|
||||
let hide_upload_banner_called = false;
|
||||
override_rewire(upload, "hide_upload_banner", (_uppy, config) => {
|
||||
hide_upload_banner_called = true;
|
||||
assert.equal(config.mode, "compose");
|
||||
});
|
||||
|
||||
const on_upload_error_callback = callbacks["upload-error"];
|
||||
$("#compose_banners .upload_banner .upload_msg").text("");
|
||||
compose_ui_replace_syntax_called = false;
|
||||
|
@ -628,6 +634,7 @@ test("uppy_events", ({override_rewire, mock_template}) => {
|
|||
assert.ok(compose_ui_replace_syntax_called);
|
||||
|
||||
$("#compose_banners .upload_banner .upload_msg").text("");
|
||||
assert.ok(hide_upload_banner_called);
|
||||
$("#compose-textarea").val("user modified text");
|
||||
on_upload_error_callback(file, null);
|
||||
assert.ok(compose_ui_replace_syntax_called);
|
||||
|
|
Loading…
Reference in New Issue