pundit: convert forum topics / forum posts to pundit.

Fix it being possible for users to delete or undelete their own forum
posts and topics, even if they were deleted by a mod.
This commit is contained in:
evazion
2020-03-16 02:42:54 -05:00
parent b3ff08fedf
commit db63b6d44f
18 changed files with 262 additions and 170 deletions

View File

@@ -18,9 +18,9 @@
<% if CurrentUser.is_member? && @forum_topic && !@forum_topic.new_record? %>
<li>|</li>
<%= subnav_link_to "Reply", new_forum_post_path(:topic_id => @forum_topic.id) %>
<% if !@forum_topic.new_record? && @forum_topic.editable_by?(CurrentUser.user) %>
<% if !@forum_topic.new_record? && policy(@forum_topic).update? %>
<%= subnav_link_to "Edit", edit_forum_topic_path(@forum_topic), "data-shortcut": "e" %>
<% if CurrentUser.is_moderator? %>
<% if policy(@forum_topic).destroy? # XXX %>
<% if @forum_topic.is_deleted? %>
<%= subnav_link_to "Undelete", undelete_forum_topic_path(@forum_topic), :method => :post %>
<% else %>