mirror of
https://github.com/zulip/zulip.git
synced 2025-11-10 17:07:07 +00:00
Abort the XHR if you close the alert or cancel the compose.
(imported from commit 21540f7b290d3f55f8116f9940554a5feb8809d7)
This commit is contained in:
@@ -211,8 +211,18 @@ exports.start = function (msg_type, opts) {
|
|||||||
$(document).trigger($.Event('compose_started.zephyr', opts));
|
$(document).trigger($.Event('compose_started.zephyr', opts));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function abort_xhr () {
|
||||||
|
$("#compose-send-button").removeAttr("disabled");
|
||||||
|
var xhr = $("#compose").data("filedrop_xhr");
|
||||||
|
if (xhr !== undefined) {
|
||||||
|
xhr.abort();
|
||||||
|
$("#compose").removeData("filedrop_xhr");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
exports.cancel = function () {
|
exports.cancel = function () {
|
||||||
compose.hide();
|
compose.hide();
|
||||||
|
abort_xhr();
|
||||||
is_composing_message = false;
|
is_composing_message = false;
|
||||||
$(document).trigger($.Event('compose_canceled.zephyr'));
|
$(document).trigger($.Event('compose_canceled.zephyr'));
|
||||||
};
|
};
|
||||||
@@ -476,6 +486,7 @@ $(function () {
|
|||||||
$("#compose-send-button").attr("disabled", "");
|
$("#compose-send-button").attr("disabled", "");
|
||||||
$("#send-status").addClass("alert-info")
|
$("#send-status").addClass("alert-info")
|
||||||
.show();
|
.show();
|
||||||
|
$(".send-status-close").one('click', abort_xhr);
|
||||||
$("#error-msg").text("Uploading…");
|
$("#error-msg").text("Uploading…");
|
||||||
},
|
},
|
||||||
error: function (err, file) {
|
error: function (err, file) {
|
||||||
|
|||||||
Reference in New Issue
Block a user