pundit: convert moderation reports to pundit.
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
<%= link_to "Delete", dmail_path(dmail, format: :js), remote: true, method: :put, "data-params": "dmail[is_deleted]=true", "data-confirm": "Are you sure you want to delete this dmail?" %>
|
||||
<% end %>
|
||||
|
||||
<% if dmail.reportable_by?(CurrentUser.user) %>
|
||||
<% if policy(dmail).reportable? %>
|
||||
| <%= link_to "Report", new_moderation_report_path(moderation_report: { model_type: "Dmail", model_id: dmail.id }), remote: true, title: "Report this dmail to the moderators" %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
<%= link_to "Respond", new_dmail_path(:respond_to_id => @dmail) %>
|
||||
| <%= link_to "Forward", new_dmail_path(:respond_to_id => @dmail, :forward => true) %>
|
||||
| <%= link_to "Share", dmail_path(@dmail, key: @dmail.key), title: "Anyone with this link will be able to view this dmail." %>
|
||||
<% if @dmail.reportable_by?(CurrentUser.user) %>
|
||||
<% if policy(@dmail).reportable? %>
|
||||
| <%= link_to "Report", new_moderation_report_path(moderation_report: { model_type: "Dmail", model_id: @dmail.id }), remote: true, title: "Report this dmail to the moderators" %>
|
||||
<% end %>
|
||||
</p>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<% if policy(forum_post).show_deleted? %>
|
||||
<article class="forum-post message" id="forum_post_<%= forum_post.id %>"
|
||||
data-forum-post-id="<%= forum_post.id %>"
|
||||
<% if CurrentUser.is_moderator? %>
|
||||
<% if policy(moderation_reports).show? %>
|
||||
data-is-reported="<%= moderation_reports.pluck(:model_id).include?(forum_post.id) %>"
|
||||
<% end %>
|
||||
data-creator="<%= forum_post.creator.name %>">
|
||||
@@ -37,7 +37,7 @@
|
||||
<li><%= link_to "Edit", edit_forum_post_path(forum_post.id), :id => "edit_forum_post_link_#{forum_post.id}", :class => "edit_forum_post_link" %></li>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% if forum_post.reportable_by?(CurrentUser.user) %>
|
||||
<% if policy(forum_post).reportable? %>
|
||||
<li><%= link_to "Report", new_moderation_report_path(moderation_report: { model_type: "ForumPost", model_id: forum_post.id }), remote: true, title: "Report this forum post to the moderators" %></li>
|
||||
<% end %>
|
||||
<% if forum_post.bulk_update_request.present? %>
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
<% if !@user.is_platinum? %>
|
||||
<%= subnav_link_to "Gift upgrade", new_user_upgrade_path(:user_id => @user.id) %>
|
||||
<% end %>
|
||||
<% if @user.reportable_by?(CurrentUser.user) %>
|
||||
<% if policy(@user).reportable? %>
|
||||
<%= subnav_link_to "Report user", new_moderation_report_path(moderation_report: { model_type: "User", model_id: @user.id }), remote: true %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
Reference in New Issue
Block a user