Abort the XHR if you close the alert or cancel the compose.

(imported from commit 21540f7b290d3f55f8116f9940554a5feb8809d7)
This commit is contained in:
Luke Faraone 2013-03-27 10:49:28 -07:00
parent 932e98f456
commit b692e8fc99
1 changed files with 11 additions and 0 deletions

View File

@ -211,8 +211,18 @@ exports.start = function (msg_type, 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 () {
compose.hide();
abort_xhr();
is_composing_message = false;
$(document).trigger($.Event('compose_canceled.zephyr'));
};
@ -476,6 +486,7 @@ $(function () {
$("#compose-send-button").attr("disabled", "");
$("#send-status").addClass("alert-info")
.show();
$(".send-status-close").one('click', abort_xhr);
$("#error-msg").text("Uploading…");
},
error: function (err, file) {