Fix remaining Rails/WhereExists
cop violations, regenerate todo (#28892)
This commit is contained in:
parent
1a565e4bea
commit
7c9c6c7f80
7 changed files with 7 additions and 22 deletions
|
@ -24,7 +24,7 @@ class ActivityPub::InboxesController < ActivityPub::BaseController
|
|||
|
||||
def unknown_affected_account?
|
||||
json = Oj.load(body, mode: :strict)
|
||||
json.is_a?(Hash) && %w(Delete Update).include?(json['type']) && json['actor'].present? && json['actor'] == value_or_id(json['object']) && !Account.where(uri: json['actor']).exists?
|
||||
json.is_a?(Hash) && %w(Delete Update).include?(json['type']) && json['actor'].present? && json['actor'] == value_or_id(json['object']) && !Account.exists?(uri: json['actor'])
|
||||
rescue Oj::ParseError
|
||||
false
|
||||
end
|
||||
|
|
|
@ -38,7 +38,7 @@ module Admin
|
|||
log_action :create, @email_domain_block
|
||||
|
||||
(@email_domain_block.other_domains || []).uniq.each do |domain|
|
||||
next if EmailDomainBlock.where(domain: domain).exists?
|
||||
next if EmailDomainBlock.exists?(domain: domain)
|
||||
|
||||
other_email_domain_block = EmailDomainBlock.create!(domain: domain, allow_with_approval: @email_domain_block.allow_with_approval, parent: @email_domain_block)
|
||||
log_action :create, other_email_domain_block
|
||||
|
|
|
@ -57,7 +57,7 @@ class StatusPolicy < ApplicationPolicy
|
|||
if record.mentions.loaded?
|
||||
record.mentions.any? { |mention| mention.account_id == current_account.id }
|
||||
else
|
||||
record.mentions.where(account: current_account).exists?
|
||||
record.mentions.exists?(account: current_account)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ class REST::AnnouncementSerializer < ActiveModel::Serializer
|
|||
end
|
||||
|
||||
def read
|
||||
object.announcement_mutes.where(account: current_user.account).exists?
|
||||
object.announcement_mutes.exists?(account: current_user.account)
|
||||
end
|
||||
|
||||
def content
|
||||
|
|
|
@ -123,7 +123,7 @@ class MoveWorker
|
|||
end
|
||||
|
||||
def add_account_note_if_needed!(account, id)
|
||||
unless AccountNote.where(account: account, target_account: @target_account).exists?
|
||||
unless AccountNote.exists?(account: account, target_account: @target_account)
|
||||
text = I18n.with_locale(account.user&.locale.presence || I18n.default_locale) do
|
||||
I18n.t(id, acct: @source_account.acct)
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue