diff --git a/Gemfile.lock b/Gemfile.lock index 124f4dde2..4a3ed9bff 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -470,7 +470,7 @@ GEM rspec-mocks (~> 3.13) rspec-support (~> 3.13) rspec-support (3.13.4) - rubocop (1.76.2) + rubocop (1.77.0) json (~> 2.3) language_server-protocol (~> 3.17.0.2) lint_roller (~> 1.1.0) @@ -923,7 +923,7 @@ CHECKSUMS rspec-mocks (3.13.5) sha256=e4338a6f285ada9fe56f5893f5457783af8194f5d08884d17a87321d5195ea81 rspec-rails (8.0.1) sha256=0c3700b10ab6d7c648c4cd554023d8c2b5b07e7f01205f7608f0c511cf686505 rspec-support (3.13.4) sha256=184b1814f6a968102b57df631892c7f1990a91c9a3b9e80ef892a0fc2a71a3f7 - rubocop (1.76.2) sha256=ae44f172ba0bbe3d623c927111798f85a7879bcc88e544d08f51f62c19f45633 + rubocop (1.77.0) sha256=1f360b4575ef7a124be27b0dfffa227a2b2d9420d22d4fd8bf179d702bcc88c0 rubocop-ast (1.45.1) sha256=94042e49adc17f187ba037b33f941ba7398fede77cdf4bffafba95190a473a3e rubocop-capybara (2.22.1) sha256=ced88caef23efea53f46e098ff352f8fc1068c649606ca75cb74650970f51c0c rubocop-factory_bot (2.27.1) sha256=9d744b5916778c1848e5fe6777cc69855bd96548853554ec239ba9961b8573fe diff --git a/app/controllers/collections_controller.rb b/app/controllers/collections_controller.rb index 17802a0ec..f895f8e6a 100644 --- a/app/controllers/collections_controller.rb +++ b/app/controllers/collections_controller.rb @@ -117,7 +117,7 @@ def save_shared # rubocop:disable Metrics/AbcSize end def leave - if @collection.users.count == 1 + if @collection.users.one? @collection.destroy redirect_to Collection, notice: t('common.notices.object_deleted', model: Collection.model_name.human) else diff --git a/app/models/user.rb b/app/models/user.rb index 031a73d21..6c232af9b 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -121,7 +121,7 @@ def handle_group_memberships def handle_collection_membership collections.each do |collection| - collection.destroy if collection.users.count == 1 + collection.destroy if collection.users.one? end end diff --git a/app/policies/application_policy.rb b/app/policies/application_policy.rb index 5e22f9fa6..24eba94c9 100644 --- a/app/policies/application_policy.rb +++ b/app/policies/application_policy.rb @@ -41,7 +41,7 @@ def admin? @user.present? && @user.role == 'admin' end - def everyone + def everyone # rubocop:disable Naming/PredicateMethod # `everyone` here means `every user logged in` @user.present? end