mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-23 15:48:43 -05:00
Added role scopes to roleable
This commit is contained in:
parent
3ae72259a6
commit
36fe8fbc6d
2 changed files with 6 additions and 3 deletions
|
@ -61,9 +61,6 @@ class User < ActiveRecord::Base
|
|||
# This is just used to pass some information into the serializer
|
||||
attr_accessor :notification_channel_position
|
||||
|
||||
scope :admins, -> { where(admin: true) }
|
||||
scope :moderators, -> { where(moderator: true) }
|
||||
scope :staff, -> { where("moderator or admin ") }
|
||||
scope :blocked, -> { where(blocked: true) } # no index
|
||||
|
||||
module NewTopicDuration
|
||||
|
|
|
@ -3,6 +3,12 @@ require 'active_support/concern'
|
|||
module Roleable
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
included do
|
||||
scope :admins, -> { where(admin: true) }
|
||||
scope :moderators, -> { where(moderator: true) }
|
||||
scope :staff, -> { where("moderator or admin ") }
|
||||
end
|
||||
|
||||
# any user that is either a moderator or an admin
|
||||
def staff?
|
||||
admin || moderator
|
||||
|
|
Loading…
Reference in a new issue