diff --git a/client/views/comments/comment_item.html b/client/views/comments/comment_item.html index 8fc1adcc0e..b11fcbb3d6 100644 --- a/client/views/comments/comment_item.html +++ b/client/views/comments/comment_item.html @@ -2,16 +2,18 @@
  • - + {{#if isModifiable}} + + {{/if}}
    @@ -27,7 +29,7 @@ {{/if}}
    {{{body_formatted}}}
    - {{#if getSetting "nestedComments" true}} + {{#if isModifiable}} {{i18n "Reply"}} {{/if}}
    diff --git a/client/views/comments/comment_item.js b/client/views/comments/comment_item.js index 62ddbcb4fa..971db28a40 100644 --- a/client/views/comments/comment_item.js +++ b/client/views/comments/comment_item.js @@ -80,7 +80,7 @@ Template.comment_item.rendered=function(){ // note: testing on the class works because Meteor apparently preserves newly assigned CSS classes // across template renderings // TODO: save scroll position - + // get comment author name var user=Meteor.users.findOne(comment.userId); var author=getDisplayName(user); @@ -100,6 +100,20 @@ Template.comment_item.rendered=function(){ Template.comment_item.helpers({ + isModifiable: function() { + // STATUS_* variables are declared in the main application (/client/main.js) file + var isAccepted = Posts.findOne(this.post).status === STATUS_IMPLEMENTED; + var isRejected = Posts.findOne(this.post).status === STATUS_REJECTED; + + // Check if nested comments are enabled + var canNest = getSetting('nestedComments'); + + if (canNest && !isAccepted && !isRejected) { + return true; + } else { + return false; + } + }, full_date: function(){ var submitted = new Date(this.submitted); return submitted.toString(); @@ -149,7 +163,7 @@ Template.comment_item.helpers({ var user = Meteor.users.findOne(this.userId); if(user) return getProfileUrl(user); - } + } }); Template.comment_item.events({ diff --git a/client/views/posts/post_page.js b/client/views/posts/post_page.js index 28a282b50d..dd1841b0e3 100644 --- a/client/views/posts/post_page.js +++ b/client/views/posts/post_page.js @@ -8,9 +8,17 @@ Template.post_page.helpers({ return html_body.autoLink(); }, canComment: function(){ - return canComment(Meteor.user()); + // STATUS_* variables are declared in the main application (/client/main.js) file + var isAccepted = this.status === STATUS_IMPLEMENTED; + var isRejected = this.status === STATUS_REJECTED; + + if (canComment(Meteor.user()) && !isAccepted && !isRejected) { + return true; + } else { + return false; + } } -}); +}); Template.post_page.rendered = function(){ if((scrollToCommentId=Session.get('scrollToCommentId')) && !this.rendered && $('#'+scrollToCommentId).exists()){