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-6004 show hidden bookmarks on a bookmarkable to admins #4758

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
6 changes: 5 additions & 1 deletion app/controllers/bookmarks_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,11 @@
def index
if @bookmarkable
access_denied unless is_admin? || @bookmarkable.visible?
@bookmarks = @bookmarkable.bookmarks.is_public.paginate(page: params[:page], per_page: ArchiveConfig.ITEMS_PER_PAGE)
@bookmarks = @bookmarkable.bookmarks.is_public
if is_admin?

Check warning on line 65 in app/controllers/bookmarks_controller.rb

View workflow job for this annotation

GitHub Actions / Rubocop

[rubocop] reported by reviewdog 🐶 Favor modifier `if` usage when having a single-line body. Another good alternative is the usage of control flow `&&`/`||`. Raw Output: app/controllers/bookmarks_controller.rb:65:7: C: Style/IfUnlessModifier: Favor modifier `if` usage when having a single-line body. Another good alternative is the usage of control flow `&&`/`||`.
walshyb marked this conversation as resolved.
Show resolved Hide resolved
@bookmarks += @bookmarkable.bookmarks.where(hidden_by_admin: true)
walshyb marked this conversation as resolved.
Show resolved Hide resolved
end
@bookmarks = @bookmarks.paginate(page: params[:page], per_page: ArchiveConfig.ITEMS_PER_PAGE)
else
base_options = {
show_private: (@user.present? && @user == current_user),
Expand Down
1 change: 1 addition & 0 deletions features/admins/admin_works.feature
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ Feature: Admin Actions for Works, Comments, Series, Bookmarks
When I follow "Hide Bookmark"
And all indexing jobs have been run
Then I should see "Item has been hidden."
And I should see "Make Bookmark Visible"
walshyb marked this conversation as resolved.
Show resolved Hide resolved
When I am logged in as "regular_user" with password "password1"
And I am on bad_user's bookmarks page
Then I should not see "Rude comment"
Expand Down
Loading