0
0
Fork 0

Consolidate account scopes for LOWER (index using) username/domain queries (#30451)

This commit is contained in:
Matt Jankowski 2024-05-28 10:11:31 -04:00 committed by GitHub
parent 32c30bf0fd
commit 4a77e477ee
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 14 additions and 48 deletions

View file

@ -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