From 3e792019e55ebe451d9bf4299ede4b6275dbd014 Mon Sep 17 00:00:00 2001 From: evazion Date: Fri, 3 Apr 2020 15:43:01 -0500 Subject: [PATCH] comments: link votes page in subnav for mods. --- app/policies/comment_vote_policy.rb | 4 ++++ app/views/comment_votes/index.html.erb | 2 ++ app/views/comments/_secondary_links.html.erb | 3 +++ 3 files changed, 9 insertions(+) diff --git a/app/policies/comment_vote_policy.rb b/app/policies/comment_vote_policy.rb index 1769427f8..46b9bf3e7 100644 --- a/app/policies/comment_vote_policy.rb +++ b/app/policies/comment_vote_policy.rb @@ -3,4 +3,8 @@ class CommentVotePolicy < ApplicationPolicy # XXX permissions are checked in Comment#unvote! true end + + def can_see_votes? + user.is_moderator? + end end diff --git a/app/views/comment_votes/index.html.erb b/app/views/comment_votes/index.html.erb index 3a18b7707..2f0884645 100644 --- a/app/views/comment_votes/index.html.erb +++ b/app/views/comment_votes/index.html.erb @@ -1,3 +1,5 @@ +<%= render "comments/secondary_links" %> +
<%= search_form_for(comment_votes_path) do |f| %> diff --git a/app/views/comments/_secondary_links.html.erb b/app/views/comments/_secondary_links.html.erb index 977536cf4..00ff842b0 100644 --- a/app/views/comments/_secondary_links.html.erb +++ b/app/views/comments/_secondary_links.html.erb @@ -2,5 +2,8 @@ <%= quick_search_form_for(:body_matches, comments_path, "comments") %> <%= subnav_link_to "Listing", comments_path(:group_by => "post") %> <%= subnav_link_to "Search", search_comments_path %> + <% if policy(CommentVote).can_see_votes? %> + <%= subnav_link_to "Votes", comment_votes_path %> + <% end %> <%= subnav_link_to "Help", wiki_page_path("help:comments") %> <% end %>