Merge remote-tracking branch 'parent/main' into upstream-20241231
This commit is contained in:
commit
3c77d4e8e4
268 changed files with 4213 additions and 3029 deletions
|
@ -43,6 +43,8 @@ class UserRole < ApplicationRecord
|
|||
EVERYONE_ROLE_ID = -99
|
||||
NOBODY_POSITION = -1
|
||||
|
||||
POSITION_LIMIT = (2**31) - 1
|
||||
|
||||
module Flags
|
||||
NONE = 0
|
||||
ALL = FLAGS.values.reduce(&:|)
|
||||
|
@ -94,6 +96,7 @@ class UserRole < ApplicationRecord
|
|||
|
||||
validates :name, presence: true, unless: :everyone?
|
||||
validates :color, format: { with: /\A#?(?:[A-F0-9]{3}){1,2}\z/i }, unless: -> { color.blank? }
|
||||
validates :position, numericality: { in: (-POSITION_LIMIT..POSITION_LIMIT) }
|
||||
|
||||
validate :validate_permissions_elevation
|
||||
validate :validate_position_elevation
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue