Disallow comment flagging when showing valuations

This commit is contained in:
Bertocq
2018-01-30 19:19:26 +01:00
parent a4718f6555
commit 033c197580
3 changed files with 13 additions and 7 deletions

View File

@@ -1,6 +1,8 @@
<span id="flag-actions-<%= dom_id(comment) %>" class="js-flag-actions">
<%= render 'comments/flag_actions', comment: comment %>
</span>
<% if local_assigns.fetch(:allow_flagging, true) %>
<span id="flag-actions-<%= dom_id(comment) %>" class="js-flag-actions">
<%= render 'comments/flag_actions', comment: comment %>
</span>
<% end %>
<span class='js-moderation-actions'>
<% if can? :hide, comment %>

View File

@@ -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 %>
<ul id="<%= dom_id(comment) %>" class="comment no-bullet small-12">
<li class="comment-body">
@@ -90,7 +91,8 @@
<%= link_to(comment_link_text(comment), "",
class: "js-add-comment-link", data: {'id': dom_id(comment)}) %>
<%= render 'comments/actions', comment: comment %>
<%= render 'comments/actions', { comment: comment,
allow_flagging: allow_flagging } %>
<%= render 'comments/form', {commentable: comment.commentable,
parent_id: comment.id,
@@ -106,8 +108,9 @@
<% child_comments_of(comment).each do |child| %>
<li>
<%= render 'comments/comment', { comment: child,
valuation: valuation } %>
allow_votes: allow_votes } %>
valuation: valuation,
allow_votes: allow_votes,
allow_flagging: allow_flagging } %>
</li>
<% end %>
</ul>

View File

@@ -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 %>
</div>