0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-04-08 02:52:39 -05:00

Fixed custom theme settings being clobbered with duplicate-named themes

refs https://github.com/TryGhost/Team/issues/1149

Ghost allows different themes to have the same `name` value in `package.json` but gives them a custom name based on the zip file used to upload it. The custom theme settings service however was always using the package.json name meaning that when syncing a theme with a duplicate name it was overwriting the settings for all other themes.

- bumped `@tryghost/custom-theme-settings-service` which changes the `.activateTheme()` signature to accept a theme name as the first argument
- updated our calls to `.activateTheme()` to pass Ghost's known theme name as the first argument so we're always syncing with the correct `theme` field value in the `custom_theme_settings` table
This commit is contained in:
Kevin Ansfield 2021-10-20 13:24:51 +01:00
parent 4e326123d3
commit 59a6f040d2
3 changed files with 8 additions and 8 deletions

View file

@ -12,7 +12,7 @@ module.exports = {
debug('Activating theme (method A on boot)', themeName);
// TODO: probably a better place for this to happen - after successful activation / when reloading site?
if (labs.isSet('customThemeSettings')) {
customThemeSettings.api.activateTheme(checkedTheme);
customThemeSettings.api.activateTheme(themeName, checkedTheme);
}
bridge.activateTheme(theme, checkedTheme);
},
@ -20,7 +20,7 @@ module.exports = {
debug('Activating theme (method B on API "activate")', themeName);
// TODO: probably a better place for this to happen - after successful activation / when reloading site?
if (labs.isSet('customThemeSettings')) {
customThemeSettings.api.activateTheme(checkedTheme);
customThemeSettings.api.activateTheme(themeName, checkedTheme);
}
bridge.activateTheme(theme, checkedTheme);
},
@ -28,7 +28,7 @@ module.exports = {
debug('Activating theme (method C on API "override")', themeName);
// TODO: probably a better place for this to happen - after successful activation / when reloading site?
if (labs.isSet('customThemeSettings')) {
customThemeSettings.api.activateTheme(checkedTheme);
customThemeSettings.api.activateTheme(themeName, checkedTheme);
}
bridge.activateTheme(theme, checkedTheme);
}

View file

@ -62,7 +62,7 @@
"@tryghost/color-utils": "0.1.2",
"@tryghost/config-url-helpers": "0.1.2",
"@tryghost/constants": "0.1.11",
"@tryghost/custom-theme-settings-service": "0.2.0",
"@tryghost/custom-theme-settings-service": "0.3.0",
"@tryghost/debug": "0.1.8",
"@tryghost/email-analytics-provider-mailgun": "1.0.3",
"@tryghost/email-analytics-service": "1.0.2",

View file

@ -1270,10 +1270,10 @@
resolved "https://registry.yarnpkg.com/@tryghost/constants/-/constants-0.1.11.tgz#ffcc6ccb10a768aaa9276c3a22b2dea9f560e247"
integrity sha512-ml1aJ4nJmfA8MRAJ3l9+iTdccGDQiUN1En8XwYwypfrKlECR8Mw/kKRPnqHge598+ED6J1+at5gArSq6bLKbug==
"@tryghost/custom-theme-settings-service@0.2.0":
version "0.2.0"
resolved "https://registry.yarnpkg.com/@tryghost/custom-theme-settings-service/-/custom-theme-settings-service-0.2.0.tgz#d48614608646a4168e4184ebd55748526849971e"
integrity sha512-JF9IqjwN+8gPCG0KiAyCtwXvAk4dealz31g+ldxSTvn+iR/+2NPrJwPqeTwjZWTY1jTFoz1UtAsEwWkNuId55Q==
"@tryghost/custom-theme-settings-service@0.3.0":
version "0.3.0"
resolved "https://registry.yarnpkg.com/@tryghost/custom-theme-settings-service/-/custom-theme-settings-service-0.3.0.tgz#dfe937666c4eb9b134d78d2d1a6bb95def6004f5"
integrity sha512-iNy9Bv/u76R1uMNcCpxfU9uWESi/cqZRPXh1uAFctBDijlI7yMkZvWIAvTn3DOplg3gMeq3xkGhL+0fNY20p9A==
dependencies:
"@tryghost/debug" "^0.1.5"
"@tryghost/errors" "^0.2.14"