Disallow comment actions on valuation comments

This commit is contained in:
Bertocq
2018-01-31 17:46:36 +01:00
parent 0f4d0b4fe9
commit 5420cd36bf
4 changed files with 10 additions and 10 deletions

View File

@@ -1,8 +1,6 @@
<% 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 id="flag-actions-<%= dom_id(comment) %>" class="js-flag-actions">
<%= render 'comments/flag_actions', comment: comment %>
</span>
<span class='js-moderation-actions'>
<% if can? :hide, comment %>

View File

@@ -1,7 +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) %>
<% allow_actions = local_assigns.fetch(:allow_actions, 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 %>
<ul id="<%= dom_id(comment) %>" class="comment no-bullet small-12">
@@ -92,8 +92,9 @@
<%= link_to(comment_link_text(comment), "",
class: "js-add-comment-link", data: {'id': dom_id(comment)}) %>
<%= render 'comments/actions', { comment: comment,
allow_flagging: allow_flagging } %>
<% if allow_actions %>
<%= render 'comments/actions', { comment: comment } %>
<% end %>
<% if allow_comments %>
<%= render 'comments/form', {commentable: comment.commentable,
@@ -113,7 +114,7 @@
<%= render 'comments/comment', { comment: child,
valuation: valuation,
allow_votes: allow_votes,
allow_flagging: allow_flagging,
allow_actions: allow_actions,
allow_comments: allow_comments } %>
</li>
<% end %>

View File

@@ -45,7 +45,7 @@
comment_flags: comment_flags,
valuation: valuation,
allow_votes: !valuation,
allow_flagging: !valuation,
allow_actions: !valuation,
allow_comments: allow_comments } %>
<% end %>
<%= paginate comment_tree.root_comments %>

View File

@@ -248,6 +248,7 @@ feature 'Internal valuation comments on Budget::Investments' do
expect(page).to have_no_css('.comment-votes')
expect(page).to have_no_css('.js-flag-actions')
expect(page).to have_no_css('.js-moderation-actions')
end
end