Don't abort the QR request if the upload if finished.

If you try to close the QR while uploading, the same logic will apply and the QR won't close.
This commit is contained in:
Nicolas Stepien 2013-02-26 18:37:01 +01:00
parent 28a472adec
commit ee1efc14fb
2 changed files with 15 additions and 4 deletions

View File

@ -5719,9 +5719,14 @@
}, },
close: function() { close: function() {
var i, _i, _len, _ref; var i, _i, _len, _ref;
if (QR.req) {
if (!QR.req.isUploadFinished) {
QR.abort();
}
return;
}
QR.nodes.el.hidden = true; QR.nodes.el.hidden = true;
QR.cleanNotifications(); QR.cleanNotifications();
QR.abort();
d.activeElement.blur(); d.activeElement.blur();
$.rmClass(QR.nodes.el, 'dump'); $.rmClass(QR.nodes.el, 'dump');
_ref = QR.replies; _ref = QR.replies;
@ -6519,7 +6524,9 @@
e.preventDefault(); e.preventDefault();
} }
if (QR.req) { if (QR.req) {
QR.abort(); if (!QR.req.isUploadFinished) {
QR.abort();
}
return; return;
} }
if (QR.cooldown.seconds) { if (QR.cooldown.seconds) {
@ -6607,6 +6614,7 @@
form: $.formData(post), form: $.formData(post),
upCallbacks: { upCallbacks: {
onload: function() { onload: function() {
QR.req.isUploadFinished = true;
QR.req.progress = '...'; QR.req.progress = '...';
return QR.status(); return QR.status();
}, },

View File

@ -62,9 +62,11 @@ QR =
message: 'Quick Reply dialog creation crashed.' message: 'Quick Reply dialog creation crashed.'
error: err error: err
close: -> close: ->
if QR.req
QR.abort() unless QR.req.isUploadFinished
return
QR.nodes.el.hidden = true QR.nodes.el.hidden = true
QR.cleanNotifications() QR.cleanNotifications()
QR.abort()
d.activeElement.blur() d.activeElement.blur()
$.rmClass QR.nodes.el, 'dump' $.rmClass QR.nodes.el, 'dump'
for i in QR.replies for i in QR.replies
@ -738,7 +740,7 @@ QR =
e?.preventDefault() e?.preventDefault()
if QR.req if QR.req
QR.abort() QR.abort() unless QR.req.isUploadFinished
return return
if QR.cooldown.seconds if QR.cooldown.seconds
@ -823,6 +825,7 @@ QR =
upCallbacks: upCallbacks:
onload: -> onload: ->
# Upload done, waiting for server response. # Upload done, waiting for server response.
QR.req.isUploadFinished = true
QR.req.progress = '...' QR.req.progress = '...'
QR.status() QR.status()
onprogress: (e) -> onprogress: (e) ->