mirror of
https://github.com/discourse/discourse.git
synced 2024-11-27 19:06:20 +08:00
59d04c0695
Changed internals so trust levels are referred to with TrustLevel[1], TrustLevel[2] etc. This gives us much better flexibility naming trust levels, these names are meant to be controlled by various communities.
17 lines
324 B
Ruby
17 lines
324 B
Ruby
require_dependency 'enum_site_setting'
|
|
|
|
class TrustLevelSetting < EnumSiteSetting
|
|
|
|
def self.valid_value?(val)
|
|
valid_values.any? { |v| v.to_s == val.to_s }
|
|
end
|
|
|
|
def self.values
|
|
@values ||= valid_values.map {|x| {name: x.to_s, value: x} }
|
|
end
|
|
|
|
def self.valid_values
|
|
TrustLevel.valid_range.to_a
|
|
end
|
|
end
|