|
|
@ -123,6 +123,7 @@ class Account < ApplicationRecord
|
|
|
|
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') }
|
|
|
|
scope :alphabetic, -> { order(domain: :asc, username: :asc) }
|
|
|
|
scope :alphabetic, -> { order(domain: :asc, username: :asc) }
|
|
|
|
|
|
|
|
scope :matches_uri_prefix, ->(value) { where(arel_table[:uri].matches("#{sanitize_sql_like(value)}/%", false, true)).or(where(uri: value)) }
|
|
|
|
scope :matches_username, ->(value) { where('lower((username)::text) LIKE lower(?)', "#{value}%") }
|
|
|
|
scope :matches_username, ->(value) { where('lower((username)::text) LIKE lower(?)', "#{value}%") }
|
|
|
|
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) }
|
|
|
|