]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
If an XHR notice is sent form a page that has no timeline, show a
authorZach Copley <zach@status.net>
Wed, 2 Dec 2009 23:32:26 +0000 (15:32 -0800)
committerZach Copley <zach@status.net>
Wed, 2 Dec 2009 23:32:26 +0000 (15:32 -0800)
message like 'Notice sent'

Conflicts:

js/util.js

js/util.js

index 5c581afb98becd5dddcf7c74ae72f7806a28d685..766201a45fd663f30490925d25ec3c58a6afe8ef 100644 (file)
@@ -218,25 +218,33 @@ var SN = { // StatusNet
                             alert(result.textContent || result.innerHTML);
                         }
                         else {
-                             notice = document._importNode($('li', data)[0], true);
-                             if ($('#'+notice.id).length === 0) {
-                                var notice_irt_value = $('#'+SN.C.S.NoticeInReplyTo).val();
-                                var notice_irt = '#notices_primary #notice-'+notice_irt_value;
-                                if($('body')[0].id == 'conversation') {
-                                    if(notice_irt_value.length > 0 && $(notice_irt+' .notices').length < 1) {
-                                        $(notice_irt).append('<ul class="notices"></ul>');
+                            var notices = $('#notices_primary .notices');
+                            if (notices.length > 0) {
+                                var notice = document._importNode($('li', data)[0], true);
+                                if ($('#'+notice.id).length === 0) {
+                                    var notice_irt_value = $('#'+SN.C.S.NoticeInReplyTo).val();
+                                    var notice_irt = '#notices_primary #notice-'+notice_irt_value;
+                                    if($('body')[0].id == 'conversation') {
+                                        if(notice_irt_value.length > 0 && $(notice_irt+' .notices').length < 1) {
+                                            $(notice_irt).append('<ul class="notices"></ul>');
+                                        }
+                                        $($(notice_irt+' .notices')[0]).append(notice);
                                     }
-                                    $($(notice_irt+' .notices')[0]).append(notice);
-                                }
-                                else {
-                                    $("#notices_primary .notices").prepend(notice);
+                                    else {
+                                        notices.prepend(notice);
+                                    }
+                                    $('#'+notice.id).css({display:'none'});
+                                    $('#'+notice.id).fadeIn(2500);
+                                    SN.U.NoticeWithAttachment($('#'+notice.id));
+                                    SN.U.NoticeReplyTo($('#'+notice.id));
+                                    SN.U.FormXHR($('#'+notice.id+' .form_favor'));
                                 }
-                                $('#'+notice.id).css({display:'none'});
-                                $('#'+notice.id).fadeIn(2500);
-                                SN.U.NoticeAttachments();
-                                SN.U.NoticeReplyTo($('#'+notice.id));
-                                SN.U.FormXHR($('#'+notice.id+' .form_favor'));
-                             }
+                            }
+                            else {
+                                result = document._importNode($('title', data)[0], true);
+                                result_title = result.textContent || result.innerHTML;
+                                form.append('<p class="success">'+result_title+'</p>');
+                            }
                         }
                         $('#'+form_id+' #'+SN.C.S.NoticeDataText).val('');
                         $('#'+form_id+' #'+SN.C.S.NoticeDataAttach).val('');