jenkins-bot has submitted this change and it was merged. Change subject: Validate the dirty flag before saving preferences in each modules ......................................................................
Validate the dirty flag before saving preferences in each modules Pressing apply button is applicable to all settings module, not only for the one that is visible. Unless we do a validation before we save preferences, other module can cause incorrect (old) preferences to be saved. Bug: 56885 Change-Id: I31df2ee0bf8b600a94e8fed1a784daf529186b16 --- M resources/js/ext.uls.displaysettings.js M resources/js/ext.uls.inputsettings.js 2 files changed, 19 insertions(+), 2 deletions(-) Approvals: Nikerabbit: Looks good to me, approved jenkins-bot: Verified diff --git a/resources/js/ext.uls.displaysettings.js b/resources/js/ext.uls.displaysettings.js index 8c3f806..70c5b6b 100644 --- a/resources/js/ext.uls.displaysettings.js +++ b/resources/js/ext.uls.displaysettings.js @@ -569,10 +569,18 @@ }, /** - * Handle the apply button press + * Handle the apply button press. + * Note that the button press may not be from the input settings module. + * For example, a user can change input settings and then go to display settings panel, + * do some changes and press apply button there. That press is applicable for all + * modules. */ apply: function () { var displaySettings = this; + if ( !displaySettings.dirty ) { + // No changes to save in this module. + return; + } // Save the preferences mw.webfonts.preferences.save( function ( result ) { diff --git a/resources/js/ext.uls.inputsettings.js b/resources/js/ext.uls.inputsettings.js index 2d7c097..09d4b16 100644 --- a/resources/js/ext.uls.inputsettings.js +++ b/resources/js/ext.uls.inputsettings.js @@ -500,7 +500,11 @@ }, /** - * Handle the apply button press + * Handle the apply button press. + * Note that the button press may not be from the input settings module. + * For example, a user can change input settings and then go to display settings panel, + * do some changes and press apply button there. That press is applicable for all + * modules. */ apply: function () { var previousIM, @@ -510,6 +514,11 @@ currentLanguage = $.ime.preferences.getLanguage(), currentIM = $.ime.preferences.getIM( currentLanguage ); + if ( !inputSettings.dirty ) { + // No changes to save in this module. + return; + } + if ( previousLanguage ) { previousIM = inputSettings.savedRegistry.imes[previousLanguage]; } -- To view, visit https://gerrit.wikimedia.org/r/94871 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I31df2ee0bf8b600a94e8fed1a784daf529186b16 Gerrit-PatchSet: 3 Gerrit-Project: mediawiki/extensions/UniversalLanguageSelector Gerrit-Branch: master Gerrit-Owner: Santhosh <santhosh.thottin...@gmail.com> Gerrit-Reviewer: Amire80 <amir.ahar...@mail.huji.ac.il> Gerrit-Reviewer: Nikerabbit <niklas.laxst...@gmail.com> Gerrit-Reviewer: jenkins-bot _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits