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

Also hides "Approve All Unreviewed Comments" when there are no unreviewed comments.
  • Loading branch information
WelpThatWorked committed Nov 23, 2024
1 parent 5ea268b commit 2216395
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
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 @comments[0] && can_review_comment?(@comments[0]) %>
<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
13 changes: 13 additions & 0 deletions features/admins/admin_works.feature
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,19 @@ Feature: Admin Actions for Works, Comments, Series, Bookmarks
Then I should see "rolex"
And I should not see "This comment has been marked as spam."

Scenario: Moderated comments cannot be approved by admin
Given the moderated work "Moderation" by "author"
And I am logged in as "commenter"
And I post the comment "Test comment" on the work "Moderation"
When I am logged in as "author"
And I view the work "Moderation"
Then I should see "Unreviewed Comments (1)"
And the comment on "Moderation" should be marked as unreviewed
When I follow "Unreviewed Comments (1)"
Then I should see "Test comment"
And I should not see "Approve All Unreviewed Comments"
And I should not see "Approve"

Scenario: Admin can edit language on works when posting without previewing
Given basic languages
And I am logged in as "regular_user"
Expand Down

0 comments on commit 2216395

Please sign in to comment.