mirror of
https://github.com/discourse/discourse.git
synced 2025-02-23 16:57:56 +08:00

Why this change? This change ensures that we validate the value of the new objects when updating typed objects theme settings.
18 lines
397 B
Ruby
18 lines
397 B
Ruby
# frozen_string_literal: true
|
|
|
|
class ThemeSettingsManager::Objects < ThemeSettingsManager
|
|
def value
|
|
has_record? ? db_record.json_value : default.map!(&:deep_stringify_keys)
|
|
end
|
|
|
|
def value=(objects)
|
|
ensure_is_valid_value!(objects)
|
|
|
|
record = has_record? ? db_record : create_record!
|
|
record.json_value = objects
|
|
record.save!
|
|
theme.reload
|
|
record.json_value
|
|
end
|
|
end
|