1
0
Fork 0
forked from gitea/nas

Merge branch 'kb_development' into kb_migration

This commit is contained in:
KMY 2023-04-28 14:33:09 +09:00
commit c4367544d7
27 changed files with 349 additions and 40 deletions

View file

@ -112,8 +112,8 @@ class Account < ApplicationRecord
scope :bots, -> { where(actor_type: %w(Application Service)) }
scope :groups, -> { where(actor_type: 'Group') }
scope :alphabetic, -> { order(domain: :asc, username: :asc) }
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_username, ->(value) { where('lower((username)::text) ~ lower(?)', "#{value}") }
scope :matches_display_name, ->(value) { where(arel_table[:display_name].matches_regexp("#{value}")) }
scope :matches_domain, ->(value) { where(arel_table[:domain].matches("%#{value}%")) }
scope :without_unapproved, -> { left_outer_joins(:user).remote.or(left_outer_joins(:user).merge(User.approved.confirmed)) }
scope :searchable, -> { without_unapproved.without_suspended.where(moved_to_account_id: nil) }