FIX: Pass values of objects typed settings to theme migrations (#26751)

This commit fixes a bug in theme settings migrations where values of `objects` typed theme settings aren't passed to migrations even when there are overriding values for those settings. What causes this bug is that, when creating the hash that contains all the overridden settings and will be passed to migrations, the values of `objects` typed settings are incorrectly retrieved from the `value` column (which is always nil for `objects` type) instead of `json_value`. `objects` settings are different from all other types in that they store their values in the `json_value` column and they need to be special-cased when retrieving their values.
This commit is contained in:
Osama Sayegh
2024-04-25 16:39:22 +03:00
committed by GitHub
parent 9d3ab91517
commit 2215fa0c8e
3 changed files with 63 additions and 1 deletions

View File

@ -10,7 +10,7 @@ class ThemeSettingsManager
def self.cast_row_value(row)
type_name = self.types.invert[row.data_type].downcase.capitalize
klass = "ThemeSettingsManager::#{type_name}".constantize
klass.cast(row.value)
klass.cast(klass.extract_value_from_row(row))
end
def self.create(name, default, type, theme, opts = {})
@ -23,6 +23,10 @@ class ThemeSettingsManager
value
end
def self.extract_value_from_row(row)
row.value
end
def initialize(name, default, theme, opts = {})
@name = name.to_sym
@default = default