- var form = replyForm = $(formEl);
- SN.Init.NoticeFormSetup(form);
-
- nextStep();
- };
- if (SN.C.I.NoticeFormMaster) {
- // We've already saved a master copy of the form.
- // Clone it in!
- intermediateStep(SN.C.I.NoticeFormMaster);
- } else {
- // Fetch a fresh copy of the notice form over AJAX.
- // Warning: this can have a delay, which looks bad.
- // @fixme this fallback may or may not work
- var url = $('#form_notice').attr('action');
- $.get(url, {ajax: 1}, function(data, textStatus, xhr) {
- intermediateStep($('form', data)[0]);
- });
- }
+ // Create the reply form entry
+ var replyItem = $('li.notice-reply', list);
+ if (replyItem.length == 0) {
+ replyItem = $('<li class="notice-reply"></li>');
+ }
+ 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;