Consolidate account scopes for LOWER
(index using) username/domain queries (#30451)
This commit is contained in:
parent
32c30bf0fd
commit
4a77e477ee
6 changed files with 14 additions and 48 deletions
|
@ -142,6 +142,8 @@ class Account < ApplicationRecord
|
|||
scope :not_excluded_by_account, ->(account) { where.not(id: account.excluded_from_timeline_account_ids) }
|
||||
scope :not_domain_blocked_by_account, ->(account) { where(arel_table[:domain].eq(nil).or(arel_table[:domain].not_in(account.excluded_from_timeline_domains))) }
|
||||
scope :dormant, -> { joins(:account_stat).merge(AccountStat.without_recent_activity) }
|
||||
scope :with_username, ->(value) { where arel_table[:username].lower.eq(value.to_s.downcase) }
|
||||
scope :with_domain, ->(value) { where arel_table[:domain].lower.eq(value&.to_s&.downcase) }
|
||||
|
||||
after_update_commit :trigger_update_webhooks
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue