From 4271435111deeea679a603188488c8e79f71d39f Mon Sep 17 00:00:00 2001 From: hylom Date: Thu, 5 Oct 2017 02:22:03 +0900 Subject: [PATCH] fix journal's comment settings to work --- src/newslash_web/public/js/base.js | 2 +- src/newslash_web/public/js/comment-tree.js | 12 ++++++++---- .../templates/common/comment/comment_header.html.tt2 | 5 ++++- .../templates/common/comment/comments.html.tt2 | 2 +- .../templates/common/components/comment_tree.html.tt2 | 2 +- src/newslash_web/templates/common/js_vars.html.tt2 | 3 +++ src/newslash_web/templates/journal/journal.html.tt2 | 16 ++++++++++++---- 7 files changed, 30 insertions(+), 12 deletions(-) diff --git a/src/newslash_web/public/js/base.js b/src/newslash_web/public/js/base.js index f7e0931a..bd807eba 100644 --- a/src/newslash_web/public/js/base.js +++ b/src/newslash_web/public/js/base.js @@ -55,7 +55,7 @@ var Comment = function () { this.tweak = 0; this.badge_id = 0; this.comment = ''; - + this.create_time = ''; this.author = ''; this.children = []; }; diff --git a/src/newslash_web/public/js/comment-tree.js b/src/newslash_web/public/js/comment-tree.js index 5863e12c..afa426d6 100644 --- a/src/newslash_web/public/js/comment-tree.js +++ b/src/newslash_web/public/js/comment-tree.js @@ -12,6 +12,7 @@ commentTree.init = function () { return { userConfig: userConfig || {}, archived: page.archived || false, + commentAllowed: page.commentAllowed || false, savable: user.is_login || false, isConfigVisible: false, }; @@ -46,7 +47,8 @@ commentTree.init = function () { template: '#comment-tree-template', data: function () { return { - archived: page.archived, + commentAllowed: page.commentAllowed, + archived: page.archived || false, comments: [], rootID: 0, }; @@ -101,7 +103,8 @@ commentTree.init = function () { secToken: '', displayForce: false, - archived: page.archived, + commentAllowed: page.commentAllowed, + archived: page.archived || false, isFormVisible: false, }; @@ -116,6 +119,7 @@ commentTree.init = function () { }, computed: { commentLocalTime: function () { + if (this.comment.create_time == "") return ""; var dt = nsUtil.decodeMySQLDateTime(this.comment.create_time); return nsUtil.formatToLocalDateTime(dt); }, @@ -179,10 +183,10 @@ commentTree.init = function () { return count[0]; }, isModerateEnabled: function () { - return this.comment.cid && (user.is_admin || (user.is_moderator && !this.archived)); + return this.comment.cid && (user.is_admin || (user.is_moderator && this.commentAllowed)); }, isReplyEnabled: function () { - return !this.archived && !this.comment.isPreview; + return this.commentAllowed && !this.comment.isPreview; }, isSignatureVisible: function () { return !userConfig.hide_signature && this.comment.signature; diff --git a/src/newslash_web/templates/common/comment/comment_header.html.tt2 b/src/newslash_web/templates/common/comment/comment_header.html.tt2 index abde023f..eda0a1f3 100644 --- a/src/newslash_web/templates/common/comment/comment_header.html.tt2 +++ b/src/newslash_web/templates/common/comment/comment_header.html.tt2 @@ -2,11 +2,14 @@
この議論は賞味期限が切れたので、アーカイブ化されています。 新たにコメントを付けることはできません。
+
+ 設定によりコメント投稿は許可されていません。 +
[%# %] - +