pundit: convert comments to pundit.

This commit is contained in:
evazion
2020-03-15 15:37:34 -05:00
parent d8e4a26906
commit a0c4617057
7 changed files with 58 additions and 45 deletions

View File

@@ -28,7 +28,7 @@
<% end %>
</div>
<% if CurrentUser.is_member? %>
<% if policy(Comment).create? %>
<div class="new-comment">
<p><%= link_to "Post comment", new_comment_path(comment: { post_id: post.id }), :class => "expand-comment-response" %></p>
<%= render "comments/form", comment: post.comments.new, hidden: true %>

View File

@@ -31,7 +31,7 @@
</div>
<%= render "application/update_notice", record: comment %>
<% if CurrentUser.is_member? %>
<% if policy(comment).create? %>
<menu>
<% if context == :index_by_comment %>
<li><%= link_to "Reply", new_comment_path(id: comment, comment: { post_id: comment.post_id }), class: "reply-link" %></li>
@@ -39,7 +39,7 @@
<li><%= link_to "Reply", new_comment_path(id: comment, comment: { post_id: comment.post_id }), class: "reply-link", remote: true %></li>
<% end %>
<% if comment.editable_by?(CurrentUser.user) %>
<% if policy(comment).update? %>
<% if comment.is_deleted? %>
<li><%= link_to "Undelete", undelete_comment_path(comment.id), method: :post, remote: true %></li>
<% else %>
@@ -60,7 +60,7 @@
<li><%= link_to "Report", new_moderation_report_path(moderation_report: { model_type: "Comment", model_id: comment.id }), remote: true %></li>
<% end %>
</menu>
<% if comment.editable_by?(CurrentUser.user) %>
<% if policy(comment).update? %>
<%= render "comments/form", comment: comment, hidden: true %>
<% end %>
<% end %>