diff options
author | Vincent Petry <pvince81@owncloud.com> | 2015-05-29 16:57:36 +0200 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2015-06-01 11:12:09 +0200 |
commit | 43b7ac6ad2f0f41efbd0811353736842ec61be17 (patch) | |
tree | 33b8fbe0cf615feaedea696a4ce6798d36824940 | |
parent | 8b635cd7b7618828bdcb8e377391d3e59070b5cf (diff) | |
download | nextcloud-server-43b7ac6ad2f0f41efbd0811353736842ec61be17.tar.gz nextcloud-server-43b7ac6ad2f0f41efbd0811353736842ec61be17.zip |
Fix LDAP wizard saveMultiSelect race condition
Whenever a checkbox is ticked in a multiselect box, it will trigger the
saving and retrieving ajax calls at the same time.
This fix makes sure that it will first save, and only once saving is
done, do the call that retrieves the filter.
-rw-r--r-- | apps/user_ldap/js/settings.js | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/apps/user_ldap/js/settings.js b/apps/user_ldap/js/settings.js index 768d62a18d1..f9f79f7314f 100644 --- a/apps/user_ldap/js/settings.js +++ b/apps/user_ldap/js/settings.js @@ -842,7 +842,12 @@ var LdapWizard = { for(var i = 0; i < resultObj.length; i++) { values = values + "\n" + resultObj[i].value; } - LdapWizard._save($('#'+originalObj)[0], $.trim(values)); + LdapWizard._save($('#'+originalObj)[0], $.trim(values)).then( + _.bind(this._updateAfterSavingMultiSelect, this, originalObj, resultObj) + ); + }, + + _updateAfterSavingMultiSelect: function(originalObj, resultObj) { var $multiSelectObj = $('#'+originalObj); var updateCount = !$multiSelectObj.multiselect("isOpen"); var applyUpdateOnCloseToFilter; @@ -879,6 +884,15 @@ var LdapWizard = { }, saveProcesses: 0, + + /** + * Saves the config value of a given input/select field + * + * @param {Object} object DOM object for the field + * @param {String} value value to save + * + * @return {Promise} promise from the save ajax call + */ _save: function(object, value) { $('#ldap .ldap_saving').removeClass('hidden'); LdapWizard.saveProcesses += 1; @@ -888,7 +902,8 @@ var LdapWizard = { '&action=save'+ '&ldap_serverconfig_chooser='+$('#ldap_serverconfig_chooser').val(); - $.post( + + return $.post( OC.filePath('user_ldap','ajax','wizard.php'), param, function(result) { |