diff --git a/app/helpers/search_helper.rb b/app/helpers/search_helper.rb index d81c25311..a5a062482 100644 --- a/app/helpers/search_helper.rb +++ b/app/helpers/search_helper.rb @@ -1,12 +1,12 @@ module SearchHelper # @param user [User] user to check - def get_accessible_posts(user) + def accessible_posts_for(user) (user&.is_moderator || user&.is_admin ? Post : Post.undeleted) .qa_only.list_includes end def search_posts - posts = get_accessible_posts(current_user) + posts = accessible_posts_for(current_user) qualifiers = params_to_qualifiers search_string = params[:search] diff --git a/test/helpers/search_helper_test.rb b/test/helpers/search_helper_test.rb index f09395e48..37cd5f4e7 100644 --- a/test/helpers/search_helper_test.rb +++ b/test/helpers/search_helper_test.rb @@ -36,14 +36,14 @@ class SearchHelperTest < ActionView::TestCase end end - test 'get_accessible_posts should correctly check access' do + test 'accessible_posts_for should correctly check access' do admin_user = users(:admin) mod_user = users(:moderator) standard_user = users(:standard_user) - admin_posts = get_accessible_posts(admin_user) - mod_posts = get_accessible_posts(mod_user) - user_posts = get_accessible_posts(standard_user) + admin_posts = accessible_posts_for(admin_user) + mod_posts = accessible_posts_for(mod_user) + user_posts = accessible_posts_for(standard_user) can_admin_get_deleted_posts = admin_posts.any?(&:deleted) can_mod_get_deleted_posts = mod_posts.any?(&:deleted)