pundit: convert misc privilege checks in views to pundit.
This commit is contained in:
@@ -2,15 +2,17 @@
|
|||||||
<%= quick_search_form_for(:body_matches, forum_posts_path, "forum posts") %>
|
<%= quick_search_form_for(:body_matches, forum_posts_path, "forum posts") %>
|
||||||
<%= subnav_link_to "Listing", forum_topics_path %>
|
<%= subnav_link_to "Listing", forum_topics_path %>
|
||||||
|
|
||||||
<% if CurrentUser.is_member? %>
|
<% if policy(ForumTopic).create? %>
|
||||||
<%= subnav_link_to "New", new_forum_topic_path %>
|
<%= 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" %>
|
<%= subnav_link_to "Mark all as read", mark_all_as_read_forum_topics_path, :method => :post, :"data-shortcut" => "shift+r" %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
<% if @forum_topic %>
|
<% 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 }) %>
|
<%= subnav_link_to "Request alias/implication", new_bulk_update_request_path(bulk_update_request: { forum_topic_id: @forum_topic.id }) %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<%= subnav_link_to "Request alias/implication", new_bulk_update_request_path %>
|
<%= subnav_link_to "Request alias/implication", new_bulk_update_request_path %>
|
||||||
<% end %>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<%= subnav_link_to "Search", search_forum_posts_path %>
|
<%= subnav_link_to "Search", search_forum_posts_path %>
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
<li><%= link_to("Curated", curated_explore_posts_path) %></li>
|
<li><%= link_to("Curated", curated_explore_posts_path) %></li>
|
||||||
<li><%= link_to("Most Viewed", viewed_explore_posts_path) %></li>
|
<li><%= link_to("Most Viewed", viewed_explore_posts_path) %></li>
|
||||||
<li><%= link_to("Votes", post_votes_path) %></li>
|
<li><%= link_to("Votes", post_votes_path) %></li>
|
||||||
<% if CurrentUser.can_approve_posts? %>
|
<% if policy(PostApproval).create? %>
|
||||||
<li><%= link_to("Modqueue", modqueue_index_path) %></li>
|
<li><%= link_to("Modqueue", modqueue_index_path) %></li>
|
||||||
<% end %>
|
<% end %>
|
||||||
</ul>
|
</ul>
|
||||||
@@ -21,9 +21,7 @@
|
|||||||
<li><h1>Post Events</h1></li>
|
<li><h1>Post Events</h1></li>
|
||||||
<li><%= link_to("Changes", post_versions_path) %></li>
|
<li><%= link_to("Changes", post_versions_path) %></li>
|
||||||
<li><%= link_to("Approvals", post_approvals_path) %></li>
|
<li><%= link_to("Approvals", post_approvals_path) %></li>
|
||||||
<% if CurrentUser.is_approver? %>
|
<li><%= link_to("Disapprovals", post_disapprovals_path) %></li>
|
||||||
<li><%= link_to("Disapprovals", post_disapprovals_path) %></li>
|
|
||||||
<% end %>
|
|
||||||
<li><%= link_to("Appeals", post_appeals_path) %></li>
|
<li><%= link_to("Appeals", post_appeals_path) %></li>
|
||||||
<li><%= link_to("Flags", post_flags_path) %></li>
|
<li><%= link_to("Flags", post_flags_path) %></li>
|
||||||
<li><%= link_to("Replacements", post_replacements_path) %></li>
|
<li><%= link_to("Replacements", post_replacements_path) %></li>
|
||||||
@@ -154,8 +152,11 @@
|
|||||||
<li><%= link_to("User Name Change Requests", user_name_change_requests_path) %></li>
|
<li><%= link_to("User Name Change Requests", user_name_change_requests_path) %></li>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% if CurrentUser.is_moderator? %>
|
<% if policy(ModerationReport).index? %>
|
||||||
<li><%= link_to("Moderation Reports", moderation_reports_path) %></li>
|
<li><%= link_to("Moderation Reports", moderation_reports_path) %></li>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<% if policy(IpAddress).index? %>
|
||||||
<li><%= link_to("IP Addresses", ip_addresses_path) %></li>
|
<li><%= link_to("IP Addresses", ip_addresses_path) %></li>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
@@ -163,8 +164,11 @@
|
|||||||
<li><%= link_to("IP Bans", ip_bans_path) %></li>
|
<li><%= link_to("IP Bans", ip_bans_path) %></li>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% if CurrentUser.is_admin? %>
|
<% if policy(NewsUpdate).index? %>
|
||||||
<li><%= link_to("News Updates", news_updates_path) %></li>
|
<li><%= link_to("News Updates", news_updates_path) %></li>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<% if CurrentUser.is_admin? %>
|
||||||
<li><%= link_to("Admin Dashboard", admin_dashboard_path) %></li>
|
<li><%= link_to("Admin Dashboard", admin_dashboard_path) %></li>
|
||||||
<% end %>
|
<% end %>
|
||||||
</ul>
|
</ul>
|
||||||
|
|||||||
@@ -27,8 +27,11 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% if CurrentUser.user.is_moderator? %>
|
<% if policy(CurrentUser.user).promote? %>
|
||||||
<%= subnav_link_to "Promote", edit_admin_user_path(@user) %>
|
<%= subnav_link_to "Promote", edit_admin_user_path(@user) %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<% if policy(Ban.new(user: @user)).create? %>
|
||||||
<% if @user.is_banned? && @user.recent_ban.present? %>
|
<% if @user.is_banned? && @user.recent_ban.present? %>
|
||||||
<%= subnav_link_to "Unban", ban_path(@user.recent_ban) %>
|
<%= subnav_link_to "Unban", ban_path(@user.recent_ban) %>
|
||||||
<% else %>
|
<% else %>
|
||||||
|
|||||||
Reference in New Issue
Block a user