mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-23 22:11:09 +03:00
Fixed cache.populate()
leaving behind old settings
refs https://github.com/TryGhost/Team/issues/1070 - if the cache is repopulated, keys that already existed in the cache but that don't exist in the new group of settings were left in the cache - added a `.clear()` method that removes all items from the cache and call it when populating so the cache only contains what it was last populated with - deletes properties on the internal content object so that references aren't lost
This commit is contained in:
parent
372e89f8ce
commit
2bb5a9cb6e
@ -12,8 +12,16 @@ module.exports = class CustomThemeSettingsCache {
|
||||
}
|
||||
|
||||
populate(settings) {
|
||||
this.clear();
|
||||
|
||||
settings.forEach((setting) => {
|
||||
this.content[setting.key] = setting.value;
|
||||
});
|
||||
}
|
||||
|
||||
clear() {
|
||||
for (const key in this.content) {
|
||||
delete this.content[key];
|
||||
}
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user