]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
If the XHR error suggests that the xhr.status is 0 (i.e., it didn't
authorSarven Capadisli <csarven@status.net>
Mon, 7 Dec 2009 09:55:12 +0000 (09:55 +0000)
committerSarven Capadisli <csarven@status.net>
Mon, 7 Dec 2009 09:55:12 +0000 (09:55 +0000)
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.

js/util.js

index 73fcf37bee5482aa90d0126d72e5899d1a86e9a4..259d5665960e0073e8b6a2278f3768bf50cb4871 100644 (file)
@@ -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>');
                             }
                         }
                     }