-
-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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 our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
π₯β¨ No more availableThemes #8085
Conversation
- this gets rid of the only places where settings.availableThemes are used
- this is no longer used anywhere - also get rid of every related call to updateSettingsCache
- Creates a tailor-made in-memory cache for themes inside the theme module - Add methods for getting & setting items on the cache - Move all references to config.availableThemes to use the new cache - This can be abstracted later to support other kinds of caches?
Still TODO: simplifying/clarifying: - what is the structure of the internal list - what is the difference between a package list, and a theme list? - what is the difference between reading a theme and loading it? - how do we update the theme list (add/remove) - how do we refresh the theme list? (hot reload?!) - how do we get from an internal list, to one that is sent as part of the API? - how are we going to handle theme storage: read/write, such that the path is configurable
res; | ||
|
||
// @TODO: remove availableThemes from settings cache and create an endpoint to fetch themes | ||
if (settings.activeTheme && themes) { |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
}; | ||
|
||
module.exports = { | ||
init: initThemes, | ||
load: loadThemes | ||
loadAllThemes: loadAllThemes, |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
core/server/api/themes.js
Outdated
|
||
if (!theme) { | ||
throw new errors.NotFoundError({message: i18n.t('errors.api.themes.themeDoesNotExist')}); | ||
} | ||
|
||
themeUtils.list.del(name); |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
delete themeListCache[key]; | ||
}, | ||
|
||
init: function init(themes) { |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
core/server/themes/loader.js
Outdated
debug('loading themes', Object.keys(themes)); | ||
config.set('paths:availableThemes', themes); | ||
settingsApi.updateSettingsCache(); | ||
list.init(themes); |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
delete themeListCache[key]; | ||
}, | ||
|
||
init: function init(themes) { |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
Done + travis has finally finished π |
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.
LGTM π
I've been waiting to push up this PR for quite a while πΉ
refs #7491
themes.list
. Which has a nice API similar to our shiny new settings cache.TODO:
The last commit has a list of areas I'm still not happy with - the API for themes lib is confusing, we want to be able to hide away much more internal logic and make it easier for the themes JSON API to interact with this library.
I also need to improve test coverage around the themes lib, I have deliberately left this as I want the structure of the objects to change.
NOTE: master still has zero support for custom templates and custom error templates π Will fix that after this goes in.