-
- // Fetch a fresh copy of the notice form over AJAX.
- var url = $('#input_form_status > form').attr('action');
- $.get(url, {ajax: 1, inreplyto: id}, function (data, textStatus, xhr) {
- var formEl = document._importNode($('form', data)[0], true);
- replyItem.append(formEl);
- list.append(replyItem);
-
- replyForm = $(formEl);
- SN.Init.NoticeFormSetup(replyForm);
- nextStep();
- });
- } else {
- replyForm = replyItem.children('form');
+ }
+ replyForm = replyItem.children('form');
+ if (replyForm.length == 0) {
+ // Let's try another trick to avoid fetching by URL
+ var noticeForm = $('#input_form_status > form');
+ if (noticeForm.length == 0) {
+ // No notice form found on the page, so let's just
+ // fetch a fresh copy of the notice form over AJAX.
+ $.ajax({
+ url: SN.V.urlNewNotice,
+ data: {ajax: 1, inreplyto: id},
+ success: function (data, textStatus, xhr) {
+ var formEl = document._importNode($('form', data)[0], true);
+ replyForm = $(formEl);
+ replyItem.append(replyForm);
+ list.append(replyItem);
+
+ SN.Init.NoticeFormSetup(replyForm);
+ nextStep();
+ },
+ });
+ // We do everything relevant in 'success' above
+ return;
+ }
+ replyForm = noticeForm.clone();