mirror of
https://github.com/glitch-soc/mastodon.git
synced 2025-12-13 15:58:50 +00:00
Fix Rails/WhereExists cop in app/models (#28863)
This commit is contained in:
@@ -57,7 +57,7 @@ class Poll < ApplicationRecord
|
||||
end
|
||||
|
||||
def voted?(account)
|
||||
account.id == account_id || votes.where(account: account).exists?
|
||||
account.id == account_id || votes.exists?(account: account)
|
||||
end
|
||||
|
||||
def own_votes(account)
|
||||
|
||||
@@ -41,7 +41,7 @@ class SessionActivation < ApplicationRecord
|
||||
|
||||
class << self
|
||||
def active?(id)
|
||||
id && where(session_id: id).exists?
|
||||
id && exists?(session_id: id)
|
||||
end
|
||||
|
||||
def activate(**options)
|
||||
|
||||
@@ -263,7 +263,7 @@ class Status < ApplicationRecord
|
||||
end
|
||||
|
||||
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
|
||||
|
||||
def emojis
|
||||
|
||||
Reference in New Issue
Block a user