mirror of
https://github.com/mastodon/mastodon.git
synced 2024-08-20 21:08:15 -07:00
Add Account.without_migrated
scope
This commit is contained in:
parent
aa4d8987a0
commit
90eb9f6f4c
2 changed files with 3 additions and 2 deletions
|
@ -125,6 +125,7 @@ class Account < ApplicationRecord
|
||||||
scope :without_suspended, -> { where(suspended_at: nil) }
|
scope :without_suspended, -> { where(suspended_at: nil) }
|
||||||
scope :without_silenced, -> { where(silenced_at: nil) }
|
scope :without_silenced, -> { where(silenced_at: nil) }
|
||||||
scope :without_instance_actor, -> { where.not(id: INSTANCE_ACTOR_ID) }
|
scope :without_instance_actor, -> { where.not(id: INSTANCE_ACTOR_ID) }
|
||||||
|
scope :without_migrated, -> { where(moved_to_account_id: nil) }
|
||||||
scope :recent, -> { reorder(id: :desc) }
|
scope :recent, -> { reorder(id: :desc) }
|
||||||
scope :bots, -> { where(actor_type: %w(Application Service)) }
|
scope :bots, -> { where(actor_type: %w(Application Service)) }
|
||||||
scope :groups, -> { where(actor_type: 'Group') }
|
scope :groups, -> { where(actor_type: 'Group') }
|
||||||
|
@ -134,7 +135,7 @@ class Account < ApplicationRecord
|
||||||
scope :matches_display_name, ->(value) { where(arel_table[:display_name].matches("#{value}%")) }
|
scope :matches_display_name, ->(value) { where(arel_table[:display_name].matches("#{value}%")) }
|
||||||
scope :without_unapproved, -> { left_outer_joins(:user).merge(User.approved.confirmed).or(remote) }
|
scope :without_unapproved, -> { left_outer_joins(:user).merge(User.approved.confirmed).or(remote) }
|
||||||
scope :auditable, -> { where(id: Admin::ActionLog.select(:account_id).distinct) }
|
scope :auditable, -> { where(id: Admin::ActionLog.select(:account_id).distinct) }
|
||||||
scope :searchable, -> { without_unapproved.without_suspended.where(moved_to_account_id: nil) }
|
scope :searchable, -> { without_unapproved.without_suspended.without_migrated }
|
||||||
scope :discoverable, -> { searchable.without_silenced.where(discoverable: true).joins(:account_stat) }
|
scope :discoverable, -> { searchable.without_silenced.where(discoverable: true).joins(:account_stat) }
|
||||||
scope :by_recent_status, -> { includes(:account_stat).merge(AccountStat.by_recent_status).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 :by_recent_activity, -> { left_joins(:user, :account_stat).order(coalesced_activity_timestamps.desc).order(id: :desc) }
|
||||||
|
|
|
@ -94,7 +94,7 @@ class RelationshipFilter
|
||||||
when 'moved'
|
when 'moved'
|
||||||
Account.where.not(moved_to_account_id: nil)
|
Account.where.not(moved_to_account_id: nil)
|
||||||
when 'primary'
|
when 'primary'
|
||||||
Account.where(moved_to_account_id: nil)
|
Account.without_migrated
|
||||||
else
|
else
|
||||||
raise Mastodon::InvalidParameterError, "Unknown status: #{value}"
|
raise Mastodon::InvalidParameterError, "Unknown status: #{value}"
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue