Use an Enum class for the Reviewable Priority Site Setting

This commit is contained in:
Robin Ward 2019-05-23 14:43:31 -04:00
parent 82f162962f
commit fad5d9c49b
2 changed files with 22 additions and 4 deletions

View File

@ -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

View File

@ -1410,10 +1410,7 @@ spam:
client: true
type: enum
default: low
choices:
- low
- medium
- high
enum: "ReviewablePrioritySetting"
rate_limits:
unique_posts_mins: 5