diff --git a/app/views/comments/_comment.html.erb b/app/views/comments/_comment.html.erb index f57876030..df065a3f9 100644 --- a/app/views/comments/_comment.html.erb +++ b/app/views/comments/_comment.html.erb @@ -2,6 +2,7 @@ <% valuation = local_assigns.fetch(:valuation, false) %> <% allow_votes = local_assigns.fetch(:allow_votes, true) %> <% allow_flagging = local_assigns.fetch(:allow_flagging, true) %> +<% allow_comments = local_assigns.fetch(:allow_comments, true) %> <% cache [locale_and_user_status(comment), comment, commentable_cache_key(comment.commentable), comment.author, (comment_flags[comment.id] if comment_flags)] do %> diff --git a/app/views/comments/_comment_tree.html.erb b/app/views/comments/_comment_tree.html.erb index 885b500b8..65c0a8177 100644 --- a/app/views/comments/_comment_tree.html.erb +++ b/app/views/comments/_comment_tree.html.erb @@ -1,5 +1,6 @@ <% commentable = comment_tree.commentable %> <% valuation = local_assigns.fetch(:valuation, false) %> +<% allow_comments = local_assigns.fetch(:allow_comments, true) %> <% cache [locale_and_user_status, comment_tree.order, commentable_cache_key(commentable), comment_tree.comments, comment_tree.comment_authors, commentable.comments_count, comment_flags] do %>
@@ -24,7 +25,7 @@
<%= t("comments.verified_only", verify_account: link_to(t("comments.verify_account"), verification_path )).html_safe %>
- <% else %> + <% elsif allow_comments %> <%= render 'comments/form', { commentable: commentable, parent_id: nil, toggeable: false, @@ -44,7 +45,8 @@ comment_flags: comment_flags, valuation: valuation, allow_votes: !valuation, - allow_flagging: !valuation } %> + allow_flagging: !valuation, + allow_comments: allow_comments } %> <% end %> <%= paginate comment_tree.root_comments %>
diff --git a/app/views/comments/_commentable_tree.html.erb b/app/views/comments/_commentable_tree.html.erb index b7af4365a..7c6a9366f 100644 --- a/app/views/comments/_commentable_tree.html.erb +++ b/app/views/comments/_commentable_tree.html.erb @@ -1,3 +1,5 @@ +<% valuation = local_assigns.fetch(:valuation, false) %> +<% allow_comments = local_assigns.fetch(:allow_comments, true) %> <% cache [locale_and_user_status, @current_order, commentable_cache_key(@investment), @comment_tree.comments, @comment_tree.comment_authors, @investment.comments_count, @comment_flags] do %>
@@ -9,11 +11,11 @@ <%= render 'shared/wide_order_selector', i18n_namespace: "comments" %> - <% if user_signed_in? %> + <% if user_signed_in? && allow_comments %> <%= render 'comments/form', { commentable: @investment, parent_id: nil, toggeable: false, - valuation: local_assigns.fetch(:valuation, false) } %> + valuation: valuation } %> <% else %>
@@ -26,7 +28,8 @@ <% @comment_tree.root_comments.each do |comment| %> <%= render 'comments/comment', { comment: comment, - valuation: local_assigns.fetch(:valuation, false) } %> + valuation: valuation, + allow_comments: allow_comments } %> <% end %> <%= paginate @comment_tree.root_comments %>
diff --git a/app/views/valuation/budget_investments/_valuation_comments.html.erb b/app/views/valuation/budget_investments/_valuation_comments.html.erb index 491ce3323..5e33e0ae8 100644 --- a/app/views/valuation/budget_investments/_valuation_comments.html.erb +++ b/app/views/valuation/budget_investments/_valuation_comments.html.erb @@ -3,5 +3,6 @@ <%= render partial: '/comments/comment_tree', locals: { comment_tree: @comment_tree, comment_flags: @comment_flags, display_comments_count: false, - valuation: true } %> + valuation: true, + allow_comments: !@budget.finished? } %> <% end %>