🐛 Fixed theme upload error when overriding existing
no issue - Cache invalidation header was set wrongly in frontend theme service - This moves cache invalidation out of theme service to themes controller by passing `themeOverriden` flag along with theme
This commit is contained in:
parent
f3ec2fb2f7
commit
e26635620e
@ -69,17 +69,18 @@ module.exports = {
|
||||
return themeLoader.loadOneTheme(shortName);
|
||||
})
|
||||
.then((loadedTheme) => {
|
||||
const overrideTheme = (shortName === settingsCache.get('active_theme'));
|
||||
// CASE: if this is the active theme, we are overriding
|
||||
if (shortName === settingsCache.get('active_theme')) {
|
||||
if (overrideTheme) {
|
||||
debug('Activating theme (method C, on API "override")', shortName);
|
||||
activate(loadedTheme, checkedTheme);
|
||||
|
||||
// CASE: clear cache
|
||||
this.headers.cacheInvalidate = true;
|
||||
}
|
||||
|
||||
// @TODO: unify the name across gscan and Ghost!
|
||||
return toJSON(shortName, checkedTheme);
|
||||
return {
|
||||
themeOverridden: overrideTheme,
|
||||
theme: toJSON(shortName, checkedTheme)
|
||||
};
|
||||
})
|
||||
.finally(() => {
|
||||
// @TODO: we should probably do this as part of saving the theme
|
||||
|
@ -74,7 +74,7 @@ themes = {
|
||||
.then(() => {
|
||||
return themeService.storage.setFromZip(zip);
|
||||
})
|
||||
.then((theme) => {
|
||||
.then(({theme}) => {
|
||||
common.events.emit('theme.uploaded');
|
||||
return theme;
|
||||
});
|
||||
|
@ -61,7 +61,11 @@ module.exports = {
|
||||
};
|
||||
|
||||
return themeService.storage.setFromZip(zip)
|
||||
.then((theme) => {
|
||||
.then(({theme, themeOverriden}) => {
|
||||
if (themeOverriden) {
|
||||
// CASE: clear cache
|
||||
this.headers.cacheInvalidate = true;
|
||||
}
|
||||
common.events.emit('theme.uploaded');
|
||||
return theme;
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user