Use an Enum class for the Reviewable Priority Site Setting
This commit is contained in:
parent
82f162962f
commit
fad5d9c49b
|
@ -0,0 +1,21 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require_dependency 'enum_site_setting'
|
||||
|
||||
class ReviewablePrioritySetting < EnumSiteSetting
|
||||
|
||||
def self.valid_value?(val)
|
||||
values.any? { |v| v[:value].to_s == val.to_s }
|
||||
end
|
||||
|
||||
def self.values
|
||||
Reviewable.priorities.map do |p|
|
||||
{ name: I18n.t("reviewables.priorities.#{p[0]}"), value: p[0] }
|
||||
end
|
||||
end
|
||||
|
||||
def self.translate_names?
|
||||
false
|
||||
end
|
||||
|
||||
end
|
|
@ -1410,10 +1410,7 @@ spam:
|
|||
client: true
|
||||
type: enum
|
||||
default: low
|
||||
choices:
|
||||
- low
|
||||
- medium
|
||||
- high
|
||||
enum: "ReviewablePrioritySetting"
|
||||
|
||||
rate_limits:
|
||||
unique_posts_mins: 5
|
||||
|
|
Loading…
Reference in New Issue