FIX: Use the default value correctly for theme settings of type uploads (#20541)

When a theme setting of type `upload` has a default upload, it should return the URL of the specified default upload until a custom upload is used for the setting. However, currently this isn't the case and we get null instead of the default upload URL.

The reason for this is because the `super` method of `#value` already returns the default upload URL (if there's one), so we can't pass that to `cdn_url` which expects an upload ID:

c961dcc757/lib/theme_settings_manager.rb (L212)

This commit fixes the bug by skipping the call to `cdn_url` when we fallback to the default upload for the setting value.
This commit is contained in:
Osama Sayegh
2023-03-06 11:41:47 +03:00
committed by GitHub
parent c961dcc757
commit 3f908c047d
3 changed files with 25 additions and 7 deletions

View File

@ -184,7 +184,7 @@ class ThemeSettingsManager
class Upload < self
def value
cdn_url(super)
has_record? ? cdn_url(db_record.value) : default
end
def default