Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AO3-5977 Hide "Approve All Unreviewed Comments" button from admins on works #4966

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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]) %>
WelpThatWorked marked this conversation as resolved.
Show resolved Hide resolved
<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 a "superadmin" admin
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 button "Approve All Unreviewed Comments"
And I should not see button "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
6 changes: 6 additions & 0 deletions features/step_definitions/web_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,12 @@
end
end

Then /^(?:|I )should not see button "([^"]*)"(?: within "([^"]*)")?$/ do |text, selector|

Check warning on line 260 in features/step_definitions/web_steps.rb

View workflow job for this annotation

GitHub Actions / Rubocop

[rubocop] reported by reviewdog 🐶 Prefer Cucumber expressions (https://github.com/cucumber/cucumber-expressions) over regex for step names; refer to https://github.com/otwcode/otwarchive/wiki/Reviewdog-and-RuboCop if regex is still required Raw Output: features/step_definitions/web_steps.rb:260:6: R: Cucumber/RegexStepName: Prefer Cucumber expressions (https://github.com/cucumber/cucumber-expressions) over regex for step names; refer to https://github.com/otwcode/otwarchive/wiki/Reviewdog-and-RuboCop if regex is still required
with_scope(selector) do
page.body.should_not have_button(text)
end
end

WelpThatWorked marked this conversation as resolved.
Show resolved Hide resolved
Then /^(?:|I )should be on (.+)$/ do |page_name|
current_path = URI.parse(current_url).path
if current_path.respond_to? :should
Expand Down
Loading