|
|
|
@ -132,12 +132,13 @@ class Account < ApplicationRecord
|
|
|
|
|
scope :auditable, -> { where(id: Admin::ActionLog.select(:account_id).distinct) }
|
|
|
|
|
scope :searchable, -> { without_unapproved.without_suspended.where(moved_to_account_id: nil) }
|
|
|
|
|
scope :discoverable, -> { searchable.without_silenced.where(discoverable: true).joins(:account_stat) }
|
|
|
|
|
scope :by_recent_status, -> { includes(:account_stat).merge(AccountStat.order('last_status_at DESC NULLS LAST')).references(:account_stat) }
|
|
|
|
|
scope :by_recent_status, -> { includes(:account_stat).merge(AccountStat.by_recent_status).references(:account_stat) }
|
|
|
|
|
scope :by_recent_activity, -> { left_joins(:user, :account_stat).order(coalesced_activity_timestamps.desc).order(id: :desc) }
|
|
|
|
|
scope :popular, -> { order('account_stats.followers_count desc') }
|
|
|
|
|
scope :by_domain_and_subdomains, ->(domain) { where(domain: Instance.by_domain_and_subdomains(domain).select(:domain)) }
|
|
|
|
|
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) }
|
|
|
|
|
|
|
|
|
|
after_update_commit :trigger_update_webhooks
|
|
|
|
|
|
|
|
|
|