pundit: convert misc privilege checks in views to pundit.

This commit is contained in:
evazion
2020-03-20 04:13:57 -05:00
parent 7f742242e4
commit 79e7b9308e
3 changed files with 22 additions and 13 deletions

View File

@@ -2,15 +2,17 @@
<%= quick_search_form_for(:body_matches, forum_posts_path, "forum posts") %>
<%= subnav_link_to "Listing", forum_topics_path %>
<% if CurrentUser.is_member? %>
<% if policy(ForumTopic).create? %>
<%= subnav_link_to "New", new_forum_topic_path %>
<% end %>
<% if policy(ForumTopic).mark_all_as_read? %>
<%= subnav_link_to "Mark all as read", mark_all_as_read_forum_topics_path, :method => :post, :"data-shortcut" => "shift+r" %>
<% end %>
<% if @forum_topic %>
<%= subnav_link_to "Request alias/implication", new_bulk_update_request_path(bulk_update_request: { forum_topic_id: @forum_topic.id }) %>
<% else %>
<%= subnav_link_to "Request alias/implication", new_bulk_update_request_path %>
<% end %>
<% if @forum_topic && policy(BulkUpdateRequest.new(forum_topic: @forum_topic)).create? %>
<%= subnav_link_to "Request alias/implication", new_bulk_update_request_path(bulk_update_request: { forum_topic_id: @forum_topic.id }) %>
<% else %>
<%= subnav_link_to "Request alias/implication", new_bulk_update_request_path %>
<% end %>
<%= subnav_link_to "Search", search_forum_posts_path %>