about summary refs log tree commit diff
path: root/app/models/account.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/account.rb')
-rw-r--r--app/models/account.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/app/models/account.rb b/app/models/account.rb
index 7e4291d55..f5ac89257 100644
--- a/app/models/account.rb
+++ b/app/models/account.rb
@@ -89,6 +89,8 @@ class Account < ApplicationRecord
   scope :recent, -> { reorder(id: :desc) }
   scope :alphabetic, -> { order(domain: :asc, username: :asc) }
   scope :by_domain_accounts, -> { group(:domain).select(:domain, 'COUNT(*) AS accounts_count').order('accounts_count desc') }
+  scope :matches_username, ->(value) { where(arel_table[:username].matches("#{value}%")) }
+  scope :matches_display_name, ->(value) { where(arel_table[:display_name].matches("#{value}%")) }
 
   delegate :email,
            :current_sign_in_ip,