From 033c197580a2fdc97d0a0165b8f0341fbb28a41e Mon Sep 17 00:00:00 2001 From: Bertocq Date: Tue, 30 Jan 2018 19:19:26 +0100 Subject: [PATCH] Disallow comment flagging when showing valuations --- app/views/comments/_actions.html.erb | 8 +++++--- app/views/comments/_comment.html.erb | 9 ++++++--- app/views/comments/_comment_tree.html.erb | 3 ++- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/app/views/comments/_actions.html.erb b/app/views/comments/_actions.html.erb index 80302a70a..2852fa09d 100644 --- a/app/views/comments/_actions.html.erb +++ b/app/views/comments/_actions.html.erb @@ -1,6 +1,8 @@ - - <%= render 'comments/flag_actions', comment: comment %> - +<% if local_assigns.fetch(:allow_flagging, true) %> + + <%= render 'comments/flag_actions', comment: comment %> + +<% end %> <% if can? :hide, comment %> diff --git a/app/views/comments/_comment.html.erb b/app/views/comments/_comment.html.erb index 5de5b6c24..f57876030 100644 --- a/app/views/comments/_comment.html.erb +++ b/app/views/comments/_comment.html.erb @@ -1,6 +1,7 @@ <% comment_flags ||= @comment_flags %> <% valuation = local_assigns.fetch(:valuation, false) %> <% allow_votes = local_assigns.fetch(:allow_votes, true) %> +<% allow_flagging = local_assigns.fetch(:allow_flagging, 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 6b0bdc296..885b500b8 100644 --- a/app/views/comments/_comment_tree.html.erb +++ b/app/views/comments/_comment_tree.html.erb @@ -43,7 +43,8 @@ <%= render 'comments/comment', { comment: comment, comment_flags: comment_flags, valuation: valuation, - allow_votes: !valuation } %> + allow_votes: !valuation, + allow_flagging: !valuation } %> <% end %> <%= paginate comment_tree.root_comments %>