pundit: convert moderation reports to pundit.

This commit is contained in:
evazion
2020-03-17 23:09:32 -05:00
parent 480f39c34a
commit 9242bf522b
16 changed files with 60 additions and 58 deletions

View File

@@ -12,7 +12,7 @@
data-is-deleted="<%= comment.is_deleted? %>"
data-is-sticky="<%= comment.is_sticky? %>"
data-below-threshold="<%= comment.score < CurrentUser.user.comment_threshold %>"
<% if CurrentUser.is_moderator? %>
<% if policy(moderation_reports).show? %>
data-is-reported="<%= moderation_reports.pluck(:model_id).include?(comment.id) %>"
<% end %>
data-is-voted="<%= comment.voted_by?(CurrentUser.user) %>">
@@ -56,7 +56,7 @@
<li class="comment-unvote-link">
<%= link_to "Unvote", comment_comment_votes_path(comment_id: comment.id), method: :delete, remote: true %>
</li>
<% if comment.reportable_by?(CurrentUser.user) %>
<% if policy(comment).reportable? %>
<li><%= link_to "Report", new_moderation_report_path(moderation_report: { model_type: "Comment", model_id: comment.id }), remote: true %></li>
<% end %>
</menu>