Merge remote-tracking branch 'parent/main' into upstream-20240109
This commit is contained in:
commit
d35fa72842
333 changed files with 4444 additions and 2541 deletions
|
@ -116,6 +116,10 @@ class Form::AdminSettings
|
|||
favicon
|
||||
).freeze
|
||||
|
||||
DIGEST_KEYS = %i(
|
||||
custom_css
|
||||
).freeze
|
||||
|
||||
OVERRIDEN_SETTINGS = {
|
||||
authorized_fetch: :authorized_fetch_mode?,
|
||||
}.freeze
|
||||
|
@ -176,6 +180,8 @@ class Form::AdminSettings
|
|||
KEYS.each do |key|
|
||||
next unless instance_variable_defined?(:"@#{key}")
|
||||
|
||||
cache_digest_value(key) if DIGEST_KEYS.include?(key)
|
||||
|
||||
if UPLOAD_KEYS.include?(key)
|
||||
public_send(key).save
|
||||
else
|
||||
|
@ -187,6 +193,18 @@ class Form::AdminSettings
|
|||
|
||||
private
|
||||
|
||||
def cache_digest_value(key)
|
||||
Rails.cache.delete(:"setting_digest_#{key}")
|
||||
|
||||
key_value = instance_variable_get(:"@#{key}")
|
||||
if key_value.present?
|
||||
Rails.cache.write(
|
||||
:"setting_digest_#{key}",
|
||||
Digest::SHA256.hexdigest(key_value)
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
def typecast_value(key, value)
|
||||
if BOOLEAN_KEYS.include?(key)
|
||||
value == '1'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue