From 80c7de998427d6c77b95ec297b84736eeecb6861 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Tue, 30 May 2023 10:09:57 -0400 Subject: [PATCH] Fix Rails/WhereExists cop in CLI (#25123) --- .rubocop_todo.yml | 1 - lib/mastodon/cli/email_domain_blocks.rb | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 3383a6b280..db65c1455d 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -890,7 +890,6 @@ Rails/WhereExists: - 'app/validators/vote_validator.rb' - 'app/workers/move_worker.rb' - 'db/migrate/20190529143559_preserve_old_layout_for_existing_users.rb' - - 'lib/mastodon/cli/email_domain_blocks.rb' - 'lib/tasks/tests.rake' - 'spec/controllers/api/v1/accounts/notes_controller_spec.rb' - 'spec/controllers/api/v1/tags_controller_spec.rb' diff --git a/lib/mastodon/cli/email_domain_blocks.rb b/lib/mastodon/cli/email_domain_blocks.rb index abbbdfe31c..88a84ecb42 100644 --- a/lib/mastodon/cli/email_domain_blocks.rb +++ b/lib/mastodon/cli/email_domain_blocks.rb @@ -39,7 +39,7 @@ module Mastodon::CLI processed = 0 domains.each do |domain| - if EmailDomainBlock.where(domain: domain).exists? + if EmailDomainBlock.exists?(domain: domain) say("#{domain} is already blocked.", :yellow) skipped += 1 next @@ -60,7 +60,7 @@ module Mastodon::CLI (email_domain_block.other_domains || []).uniq.each do |hostname| another_email_domain_block = EmailDomainBlock.new(domain: hostname, parent: email_domain_block) - if EmailDomainBlock.where(domain: hostname).exists? + if EmailDomainBlock.exists?(domain: hostname) say("#{hostname} is already blocked.", :yellow) skipped += 1 next