DEV: Add file_size_restriction site setting type (#24704)

This change will allow admins to configure file sizes in mb instead of
having to convert to kb.

Co-authored-by: Ella <ella.estigoy@gmail.com>
This commit is contained in:
Blake Erickson
2023-12-13 16:22:48 -07:00
committed by GitHub
parent 89826ef56d
commit 00209f03e6
15 changed files with 382 additions and 31 deletions

View File

@ -55,6 +55,7 @@ class SiteSettings::TypeSupervisor
emoji_list: 24,
html_deprecated: 25,
tag_group_list: 26,
file_size_restriction: 27,
)
end
@ -180,7 +181,7 @@ class SiteSettings::TypeSupervisor
end
end
if type == :integer
if type == :integer || type == :file_size_restriction
result[:min] = @validators[name].dig(:opts, :min) if @validators[name].dig(
:opts,
:min,
@ -304,6 +305,8 @@ class SiteSettings::TypeSupervisor
GroupSettingValidator
when self.class.types[:integer]
IntegerSettingValidator
when self.class.types[:file_size_restriction]
IntegerSettingValidator
when self.class.types[:regex]
RegexSettingValidator
when self.class.types[:string], self.class.types[:list], self.class.types[:enum]