diff options
author | Sarven Capadisli <csarven@status.net> | 2009-12-07 09:55:12 +0000 |
---|---|---|
committer | Sarven Capadisli <csarven@status.net> | 2009-12-07 09:55:12 +0000 |
commit | af0f905e2487bd00a0c888f1ddc704fb8ce44731 (patch) | |
tree | dd36c74419d6a3fbad394be3aca23242a22f7f6e | |
parent | 49005881bd31a022e59574277866aada41e4b76d (diff) |
If the XHR error suggests that the xhr.status is 0 (i.e., it didn't
receive an XHR object as expected), threat it as a success like HTTP
20x or 30x because the notice most likely went through. jquery.form.js
(for file uploads) and meteor.js both use an iframe and they (somehow)
appear to be in conflict. Notice always goes through, however,
xhr.status is 0. Further investigation is needed.
-rw-r--r-- | js/util.js | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/js/util.js b/js/util.js index 73fcf37be..259d56659 100644 --- a/js/util.js +++ b/js/util.js @@ -192,12 +192,13 @@ var SN = { // StatusNet form.append(document._importNode($('.'+SN.C.S.Error, xhr.responseXML)[0], true)); } else { - if(jQuery.inArray(parseInt(xhr.status), SN.C.I.HTTP20x30x) < 0) { - form.append('<p class="error>(Sorry! We had trouble sending your notice ('+xhr.status+' '+xhr.statusText+'). Please report the problem to the site administrator if this happens again.</p>'); + if (parseInt(xhr.status) === 0 || jQuery.inArray(parseInt(xhr.status), SN.C.I.HTTP20x30x) >= 0) { + $('#'+form_id).resetForm(); + $('#'+form_id+' #'+SN.C.S.NoticeDataAttachSelected).remove(); + SN.U.FormNoticeEnhancements($('#'+form_id)); } else { - $('#'+form_id+' #'+SN.C.S.NoticeDataText).val(''); - SN.U.FormNoticeEnhancements($('#'+form_id)); + form.append('<p class="error>(Sorry! We had trouble sending your notice ('+xhr.status+' '+xhr.statusText+'). Please report the problem to the site administrator if this happens again.</p>'); } } } |