[Pkg-owncloud-commits] [owncloud] 04/62: Fix LDAP wizard saveMultiSelect race condition

David Prévot taffit at moszumanska.debian.org
Tue Jun 23 23:39:32 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to annotated tag v8.0.5beta
in repository owncloud.

commit 43b7ac6ad2f0f41efbd0811353736842ec61be17
Author: Vincent Petry <pvince81 at owncloud.com>
Date:   Fri May 29 16:57:36 2015 +0200

    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.
---
 apps/user_ldap/js/settings.js | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/apps/user_ldap/js/settings.js b/apps/user_ldap/js/settings.js
index 768d62a..f9f79f7 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) {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list