Wizard: Support to prevent the "settings updated" dialog

Subwizards might actually intentionally want to update stuff through
the settings API, let's allow that.
This commit is contained in:
Gina Häußge 2017-07-20 19:36:14 +02:00
parent d0f5592421
commit aab3a7bd63

View file

@ -192,9 +192,25 @@ $(function() {
self.onSettingsPreventRefresh = function() {
if (!self.finishing && self.isDialogActive()
&& hasDataChanged(self.settingsViewModel.getLocalData(), self.settingsViewModel.lastReceivedSettings)) {
var preventSettingsRefreshDialog = false;
callViewModels(allViewModels, "onWizardPreventSettingsRefreshDialog", function(method) {
// if any of our methods returns that it wants to prevent the dialog
// we'll need to set preventSettingsRefreshDialog to true
//
// order is important here - the method call needs to happen
// first, or it won't happen after the flag has been
// set once due to the || making further evaluation unnecessary
// then
preventSettingsRefreshDialog = (method() === true) || preventSettingsRefreshDialog;
});
// we have local changes, show update dialog
self.settingsViewModel.settingsUpdatedDialog.modal("show");
return true;
if (preventSettingsRefreshDialog) {
return false;
} else {
self.settingsViewModel.settingsUpdatedDialog.modal("show");
return true;
}
}
return false;