+++ /dev/null
-require 'test_helper'
-
-class TrashItemsControllerTest < ActionController::TestCase
- reset_api_fixtures :after_each_test, false
- reset_api_fixtures :after_suite, true
-
- [
- :active,
- :admin,
- ].each do |user|
- test "trash index page as #{user}" do
- get :index, {partial: :trash_rows, format: :json}, session_for(user)
- assert_response :success
-
- items = []
- @response.body.scan(/tr\ data-object-uuid=\\"(.*?)\\"/).each do |uuid,|
- items << uuid
- end
-
- assert_includes(items, api_fixture('collections')['unique_expired_collection']['uuid'])
- if user == :admin
- assert_includes(items, api_fixture('collections')['unique_expired_collection2']['uuid'])
- else
- assert_not_includes(items, api_fixture('collections')['unique_expired_collection2']['uuid'])
- end
- end
- end
-end
def find_objects_for_index
if params[:include_trash] || ['destroy', 'trash', 'untrash'].include?(action_name)
- @objects = Collection.readable_by(*@read_users).unscoped
+ @objects = Collection.unscoped.readable_by(*@read_users)
end
super
end
# Check if any of the users are admin. If so, we're done.
if users_list.select { |u| u.is_admin }.any?
- return self
+ # Return existing relation with no new filters.
+ return where({})
end
# Collect the UUIDs of the authorized users.