pundit: convert moderator/post/posts to pundit.

This commit is contained in:
evazion
2020-03-20 02:28:16 -05:00
parent 1344d4c161
commit d51b0dfe17
4 changed files with 34 additions and 24 deletions

View File

@@ -52,10 +52,10 @@
<% if policy(PostApproval).create? %>
<% if post.is_deleted? %>
<li id="post-option-undelete"><%= link_to "Undelete", post_approvals_path(post_id: post.id), remote: true, method: :post, "data-confirm": "Are you sure you want to undelete this post?" %></li>
<% if post.fav_count > 0 && post.parent_id %>
<% if policy(post).move_favorites? %>
<li id="post-option-move-favorites"><%= link_to "Move favorites", confirm_move_favorites_moderator_post_post_path(post_id: post.id) %></li>
<% end %>
<% else %>
<% elsif policy(post).delete? %>
<li id="post-option-delete"><%= link_to "Delete", confirm_delete_moderator_post_post_path(post_id: post.id) %></li>
<% end %>
@@ -64,13 +64,13 @@
<li id="post-option-disapprove"><%= link_to "Hide from queue", post_disapprovals_path(post_disapproval: { post_id: post.id, reason: "disinterest" }), remote: true, method: :post, id: "disapprove" %></li>
<% end %>
<% if post.is_banned? %>
<% if policy(post).unban? %>
<li id="post-option-unban"><%= link_to "Unban", unban_moderator_post_post_path(post), method: :post, "data-confirm": "Are you sure you want to unban this post?" %></li>
<% else %>
<% elsif policy(post).ban? %>
<li id="post-option-ban"><%= link_to "Ban", ban_moderator_post_post_path(post), method: :post, "data-confirm": "Are you sure you want to ban this post?" %></li>
<% end %>
<% if CurrentUser.is_admin? %>
<% if policy(post).expunge? %>
<li id="post-option-expunge"><%= link_to "Expunge", expunge_moderator_post_post_path(post_id: post.id), remote: true, method: :post, "data-confirm": "This will permanently delete this post (meaning the file will be deleted). Are you sure you want to delete this post?" %></li>
<% end %>
<% end %>