DEV: Add new user scopes (#17026)
Adds two new user scopes: - `not_staged` - `activated_not_suspended_not_staged` This will allow us to easily grab activated users that are not suspended or staged. See this PR feedback: https://github.com/discourse/discourse-chat/pull/913#discussion_r890692266
This commit is contained in:
parent
de1153286d
commit
27d7b0c6de
|
@ -220,6 +220,8 @@ class User < ActiveRecord::Base
|
|||
scope :suspended, -> { where('suspended_till IS NOT NULL AND suspended_till > ?', Time.zone.now) }
|
||||
scope :not_suspended, -> { where('suspended_till IS NULL OR suspended_till <= ?', Time.zone.now) }
|
||||
scope :activated, -> { where(active: true) }
|
||||
scope :not_staged, -> { where(staged: false) }
|
||||
scope :activated_not_suspended_not_staged, -> { self.activated.not_suspended.not_staged }
|
||||
|
||||
scope :filter_by_username, ->(filter) do
|
||||
if filter.is_a?(Array)
|
||||
|
|
Loading…
Reference in New Issue