Fix Rails/WhereExists cop in CLI (#25123)

This commit is contained in:
Matt Jankowski 2023-05-30 10:09:57 -04:00 committed by GitHub
parent b7b96efd17
commit 80c7de9984
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 3 deletions

View file

@ -890,7 +890,6 @@ Rails/WhereExists:
- 'app/validators/vote_validator.rb' - 'app/validators/vote_validator.rb'
- 'app/workers/move_worker.rb' - 'app/workers/move_worker.rb'
- 'db/migrate/20190529143559_preserve_old_layout_for_existing_users.rb' - 'db/migrate/20190529143559_preserve_old_layout_for_existing_users.rb'
- 'lib/mastodon/cli/email_domain_blocks.rb'
- 'lib/tasks/tests.rake' - 'lib/tasks/tests.rake'
- 'spec/controllers/api/v1/accounts/notes_controller_spec.rb' - 'spec/controllers/api/v1/accounts/notes_controller_spec.rb'
- 'spec/controllers/api/v1/tags_controller_spec.rb' - 'spec/controllers/api/v1/tags_controller_spec.rb'

View file

@ -39,7 +39,7 @@ module Mastodon::CLI
processed = 0 processed = 0
domains.each do |domain| domains.each do |domain|
if EmailDomainBlock.where(domain: domain).exists? if EmailDomainBlock.exists?(domain: domain)
say("#{domain} is already blocked.", :yellow) say("#{domain} is already blocked.", :yellow)
skipped += 1 skipped += 1
next next
@ -60,7 +60,7 @@ module Mastodon::CLI
(email_domain_block.other_domains || []).uniq.each do |hostname| (email_domain_block.other_domains || []).uniq.each do |hostname|
another_email_domain_block = EmailDomainBlock.new(domain: hostname, parent: email_domain_block) 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) say("#{hostname} is already blocked.", :yellow)
skipped += 1 skipped += 1
next next