mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-20 22:42:53 -05:00
🐛 Fixed issue with settings being marked as dirty when visibility is changed (#18370)
refs https://github.com/TryGhost/Product/issues/3924 Settings were being marked as dirty when visibility was changed causing the confirm dialog to show when navigating away from the settings page. This change manually computes the dirtiness of the setting to ensure the visibility change is ignored
This commit is contained in:
parent
7bebe7daf4
commit
497f3b40dd
1 changed files with 10 additions and 0 deletions
|
@ -100,6 +100,16 @@ export default class CustomThemeSettingsServices extends Service {
|
||||||
updateSettingsVisibility() {
|
updateSettingsVisibility() {
|
||||||
this.settings.forEach((setting) => {
|
this.settings.forEach((setting) => {
|
||||||
setting.visible = this._isSettingVisible(setting);
|
setting.visible = this._isSettingVisible(setting);
|
||||||
|
|
||||||
|
// Updating the setting visibility will cause the setting to be marked as dirty so
|
||||||
|
// we need to compute whether the setting is actually dirty and set the flag manually
|
||||||
|
const changedProperties = Object.keys(setting.changedAttributes()).filter(key => key !== 'visible');
|
||||||
|
|
||||||
|
setting.hasDirtyAttributes = false;
|
||||||
|
|
||||||
|
if (changedProperties.length > 0) {
|
||||||
|
setting.hasDirtyAttributes = true;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue