OSDN Git Service

fix to post sub-comment in comment single page
authorhylom <hylom@users.sourceforge.jp>
Tue, 28 Nov 2017 11:22:55 +0000 (20:22 +0900)
committerhylom <hylom@users.sourceforge.jp>
Tue, 28 Nov 2017 11:22:55 +0000 (20:22 +0900)
src/newslash_web/public/js/comment-tree.js
src/newslash_web/templates/common/components/comment_tree.html.tt2

index afa426d..00f8318 100644 (file)
@@ -407,10 +407,17 @@ commentTree.init = function () {
       comment: this.rawComment,
       discussion_id: page.discussionID,
       stoid: page.stoid,
-      pid: this.replyTo ? this.replyTo.cid : 0,
+      pid: 0,
       action: 'post',
       csrf_token: this.csrfToken,
     };
+
+    if (this.replyTo) {
+      data.pid = this.replyTo.cid;
+    } else if (page.commentID) {
+      data.pid = page.commentID;
+    }
+
     this.$newslash.post("comment", data,
       (response) => { // success
         var newComment = response.body.new_comment;
index c2191be..2cc7e8c 100644 (file)
@@ -42,5 +42,6 @@
 </script>
 
 
-<script src="/js/comment-tree.js" ></script>
+[% NS.load_js("comment-tree.js") %]
+[%# <script src="/js/comment-tree.js" ></script> %]