Skip to content

Commit

Permalink
AO3-5977 Hide "Approve All Unreviewed Comments" button from admins on…
Browse files Browse the repository at this point in the history
… works
  • Loading branch information
WelpThatWorked committed Nov 21, 2024
1 parent 5ea268b commit c4f194a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions app/controllers/comments_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ def unreviewed
.unreviewed_only
.for_display
.page(params[:page])
@reviewable = (@commentable.is_a?(AdminPost) || current_user_owns?(@commentable))
end

# GET /comments/1
Expand Down
10 changes: 6 additions & 4 deletions app/views/comments/unreviewed.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
<!--/descriptions-->

<!--Subnavigation, sorting and actions-->
<ul class="navigation actions">
<% path = @commentable.is_a?(AdminPost) ? review_all_admin_post_comments_path(@commentable) : review_all_work_comments_path(@commentable) %>
<li><%= button_to(t(".approve_all"), path, method: :put) %></li>
</ul>
<% if @reviewable %>
<ul class="navigation actions">
<% path = @commentable.is_a?(AdminPost) ? review_all_admin_post_comments_path(@commentable) : review_all_work_comments_path(@commentable) %>
<li><%= button_to(t(".approve_all"), path, method: :put) %></li>
</ul>
<% end %>
<!--/subnav-->

<!--main content-->
Expand Down

0 comments on commit c4f194a

Please sign in to comment.