-
Notifications
You must be signed in to change notification settings - Fork 462
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
base: master
Are you sure you want to change the base?
AO3-6004 show hidden bookmarks on a bookmarkable to admins #4758
Conversation
@@ -61,7 +61,9 @@ def search | |||
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 | |||
@bookmarks += @bookmarkable.bookmarks.where(hidden_by_admin: true) if is_admin? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a bit weird how I'm doing it, but I didn't see another way to include bookmarks that have been hidden by admin and the public bookmarks.
Also should I add check for policy_and_abuse
role?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a quick drive-by comment, not a thorough review:
- Let's not check the admin role, since I'm pretty sure we don't currently check it for, e.g., accessing hidden works directly. But maybe we should changes this two instances of
is_admin?
tologged_in_as_admin?
-- this seems to be the only file where we useis_admin?
and that's weird, imo. - I'm guessing the problem with simply removing the
is_public
scope is you get private bookmarks as well as those hidden by admin? Would changing it to thenot_private
scope fix that? If not, I'd suggest defining a new scope in the bookmark model that will get public bookmarks, regardless of whether they're hidden by admin.
@@ -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" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should I add another check to follow this and confirm visible from regular user end?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A regular user should not be able to see a hidden bookmark. But it would be nice to have a check that an admin can see the text of the hidden bookmark.
Pull Request Checklist
as the first thing in your pull request title (e.g.
AO3-1234 Fix thing
)until they are reviewed and merged before creating new pull requests.
Issue
https://otwarchive.atlassian.net/browse/AO3-6004
Purpose
Allows admins to show hidden bookmarks on a bookmarkable
Testing Instructions
Credit
Brandon W (he/him/they/them)