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-5225 Fix include_private? when pseud_ids are specified. #3233

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions app/models/search/bookmark_query.rb
Expand Up @@ -277,7 +277,8 @@ def include_private?
# Use fetch instead of || here to make sure that we don't accidentally
# override a deliberate choice not to show private bookmarks.
options.fetch(:show_private,
User.current_user && user_ids.include?(User.current_user.id))
User.current_user.is_a?(User) &&
user_ids.include?(User.current_user.id))
end

def include_restricted?
Expand All @@ -292,7 +293,7 @@ def user_ids
user_ids += options[:user_ids].map(&:to_i)
end
if options[:pseud_ids].present?
user_ids += Pseud.where(id: options[:pseud_id]).pluck(:user_id)
user_ids += Pseud.where(id: options[:pseud_ids]).pluck(:user_id)
end
user_ids
end
Expand Down