about summary refs log tree commit diff
path: root/app/models/form
diff options
context:
space:
mode:
authorzunda <zundan@gmail.com>2022-10-26 20:14:07 +0000
committerGitHub <noreply@github.com>2022-10-26 22:14:07 +0200
commit52ebfb7792c29eba1472ec358c2420ba443ba24d (patch)
tree1b63d9e10799a10857aba7c9e88c13a584795b0b /app/models/form
parent1546538de9f9ab3781d7cee3e07880646124df11 (diff)
Store integer settings as integer (#19478)
Diffstat (limited to 'app/models/form')
-rw-r--r--app/models/form/admin_settings.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/app/models/form/admin_settings.rb b/app/models/form/admin_settings.rb
index 957a32b7c..431d33bcd 100644
--- a/app/models/form/admin_settings.rb
+++ b/app/models/form/admin_settings.rb
@@ -33,6 +33,12 @@ class Form::AdminSettings
     backups_retention_period
   ).freeze
 
+  INTEGER_KEYS = %i(
+    media_cache_retention_period
+    content_cache_retention_period
+    backups_retention_period
+  ).freeze
+
   BOOLEAN_KEYS = %i(
     timeline_preview
     activity_api_enabled
@@ -104,6 +110,8 @@ class Form::AdminSettings
   def typecast_value(key, value)
     if BOOLEAN_KEYS.include?(key)
       value == '1'
+    elsif INTEGER_KEYS.include?(key)
+      value.blank? ? value : Integer(value)
     else
       value
     end