Fix Rails/WhereExists
cop in app/models (#28863)
This commit is contained in:
parent
599bc69503
commit
9d413cbaf8
4 changed files with 3 additions and 6 deletions
|
@ -81,9 +81,6 @@ Rails/WhereExists:
|
||||||
- 'app/lib/delivery_failure_tracker.rb'
|
- 'app/lib/delivery_failure_tracker.rb'
|
||||||
- 'app/lib/feed_manager.rb'
|
- 'app/lib/feed_manager.rb'
|
||||||
- 'app/lib/suspicious_sign_in_detector.rb'
|
- 'app/lib/suspicious_sign_in_detector.rb'
|
||||||
- 'app/models/poll.rb'
|
|
||||||
- 'app/models/session_activation.rb'
|
|
||||||
- 'app/models/status.rb'
|
|
||||||
- 'app/policies/status_policy.rb'
|
- 'app/policies/status_policy.rb'
|
||||||
- 'app/serializers/rest/announcement_serializer.rb'
|
- 'app/serializers/rest/announcement_serializer.rb'
|
||||||
- 'app/workers/move_worker.rb'
|
- 'app/workers/move_worker.rb'
|
||||||
|
|
|
@ -57,7 +57,7 @@ class Poll < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def voted?(account)
|
def voted?(account)
|
||||||
account.id == account_id || votes.where(account: account).exists?
|
account.id == account_id || votes.exists?(account: account)
|
||||||
end
|
end
|
||||||
|
|
||||||
def own_votes(account)
|
def own_votes(account)
|
||||||
|
|
|
@ -41,7 +41,7 @@ class SessionActivation < ApplicationRecord
|
||||||
|
|
||||||
class << self
|
class << self
|
||||||
def active?(id)
|
def active?(id)
|
||||||
id && where(session_id: id).exists?
|
id && exists?(session_id: id)
|
||||||
end
|
end
|
||||||
|
|
||||||
def activate(**options)
|
def activate(**options)
|
||||||
|
|
|
@ -263,7 +263,7 @@ class Status < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def reported?
|
def reported?
|
||||||
@reported ||= Report.where(target_account: account).unresolved.where('? = ANY(status_ids)', id).exists?
|
@reported ||= Report.where(target_account: account).unresolved.exists?(['? = ANY(status_ids)', id])
|
||||||
end
|
end
|
||||||
|
|
||||||
def emojis
|
def emojis
|
||||||
|
|
Loading…
Reference in a new issue