- Notifications
You must be signed in to change notification settings - Fork8.8k
DEV: Hydrate theme setting uploads#36696
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
Conversation
frontend/discourse/admin/components/schema-setting/types/upload.gjs OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
Grubba27 left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I think it makes sense!
Uh oh!
There was an error while loading.Please reload this page.
| MultiJson.dump(ThemeSiteSetting.generate_defaults_map) | ||
| else | ||
| MultiJson.dump(theme_site_settings[theme_id]) | ||
| settings=theme_site_settings[theme_id].dup |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Why isdup needed here? not calling it mutates@theme_site_settings[provider.current_site]?
| # Hydrate uploads in object settings for themes | ||
| settings.eachdo |name,value| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Would it be possible to skip this loop if we knew that there would be no upload to hydrate?
Uh oh!
There was an error while loading.Please reload this page.
| } | ||
| if (Number.isInteger(value)) { | ||
| constcachedUpload=uploadCache.get(value); | ||
| return cachedUpload?.url||null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Is there a reason for this|| null?
If there is nourl property, it will returnundefined and I think Ember treats both null and undefined in a similar manner(both arefalsy)
Uh oh!
There was an error while loading.Please reload this page.
After the changes#36665, we needed to hydrate uploads for themes as well. This PR introduces the necessary changes:
hydrate_uploads_in_objectsandhydrate_uploads_in_objectnon-private to call them fromapp/serializers/theme_settings_serializer.rb