summaryrefslogtreecommitdiffstats
path: root/apps/user_ldap/js
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@owncloud.com>2016-02-12 21:51:06 +0100
committerArthur Schiwon <blizzz@owncloud.com>2016-02-12 21:51:06 +0100
commit62aac81c4558f490257088288d37a9dd7596e7b5 (patch)
treedec9b496e7890494d92a2c1aaa3f9af1fc3793b7 /apps/user_ldap/js
parentb5bf32bc34a410d1f0756ffcda5eb7dfeca67134 (diff)
downloadnextcloud-server-62aac81c4558f490257088288d37a9dd7596e7b5.tar.gz
nextcloud-server-62aac81c4558f490257088288d37a9dd7596e7b5.zip
Fix race condition when switching filter mode. Fixes #22278
Diffstat (limited to 'apps/user_ldap/js')
-rw-r--r--apps/user_ldap/js/wizard/wizardTabGeneric.js31
-rw-r--r--apps/user_ldap/js/wizard/wizardTabGroupFilter.js2
-rw-r--r--apps/user_ldap/js/wizard/wizardTabLoginFilter.js2
-rw-r--r--apps/user_ldap/js/wizard/wizardTabUserFilter.js2
4 files changed, 32 insertions, 5 deletions
diff --git a/apps/user_ldap/js/wizard/wizardTabGeneric.js b/apps/user_ldap/js/wizard/wizardTabGeneric.js
index 8940a8468a0..21085e3a584 100644
--- a/apps/user_ldap/js/wizard/wizardTabGeneric.js
+++ b/apps/user_ldap/js/wizard/wizardTabGeneric.js
@@ -28,6 +28,12 @@ OCA = OCA || {};
*/
bjQuiButtonClass: 'ui-button',
+ /**
+ * @property {bool} - indicates whether a filter mode toggle operation
+ * is still in progress
+ */
+ isToggling: false,
+
/** @inheritdoc */
init: function(tabIndex, tabID) {
this.tabIndex = tabIndex;
@@ -408,6 +414,20 @@ OCA = OCA || {};
},
/**
+ * sets the filter mode initially and resets the "isToggling" marker.
+ * This method is called after a save operation against the mode key.
+ *
+ * @param mode
+ */
+ setFilterModeOnce: function(mode) {
+ this.isToggling = false;
+ if(!this.filterModeInitialized) {
+ this.filterModeInitialized = true;
+ this.setFilterMode(mode);
+ }
+ },
+
+ /**
* sets the filter mode according to the provided configuration value
*
* @param {string} mode
@@ -568,8 +588,15 @@ OCA = OCA || {};
this.filterModeDisableableElements = filterModeDisableableElements;
this.filterModeStateElement = filterModeStateElement;
this.filterModeKey = filterModeKey;
- $switcher.click(this._toggleRawFilterMode);
- }
+ var view = this;
+ $switcher.click(function() {
+ if(view.isToggling) {
+ return;
+ }
+ view.isToggling = true;
+ view._toggleRawFilterMode();
+ });
+ },
});
diff --git a/apps/user_ldap/js/wizard/wizardTabGroupFilter.js b/apps/user_ldap/js/wizard/wizardTabGroupFilter.js
index 528b5d83670..3fbff9de9a0 100644
--- a/apps/user_ldap/js/wizard/wizardTabGroupFilter.js
+++ b/apps/user_ldap/js/wizard/wizardTabGroupFilter.js
@@ -26,7 +26,7 @@ OCA = OCA || {};
featureName: 'GroupObjectClasses'
},
ldap_group_filter_mode: {
- setMethod: 'setFilterMode'
+ setMethod: 'setFilterModeOnce'
},
ldap_groupfilter_groups: {
$element: $('#ldap_groupfilter_groups'),
diff --git a/apps/user_ldap/js/wizard/wizardTabLoginFilter.js b/apps/user_ldap/js/wizard/wizardTabLoginFilter.js
index 691ddb5ac9a..7b9a408784a 100644
--- a/apps/user_ldap/js/wizard/wizardTabLoginFilter.js
+++ b/apps/user_ldap/js/wizard/wizardTabLoginFilter.js
@@ -32,7 +32,7 @@ OCA = OCA || {};
setMethod: 'setLoginAttributeEmail'
},
ldap_login_filter_mode: {
- setMethod: 'setFilterMode'
+ setMethod: 'setFilterModeOnce'
},
ldap_loginfilter_attributes: {
$element: $('#ldap_loginfilter_attributes'),
diff --git a/apps/user_ldap/js/wizard/wizardTabUserFilter.js b/apps/user_ldap/js/wizard/wizardTabUserFilter.js
index 4fe223ee075..da7cb77568e 100644
--- a/apps/user_ldap/js/wizard/wizardTabUserFilter.js
+++ b/apps/user_ldap/js/wizard/wizardTabUserFilter.js
@@ -26,7 +26,7 @@ OCA = OCA || {};
featureName: 'UserObjectClasses'
},
ldap_user_filter_mode: {
- setMethod: 'setFilterMode'
+ setMethod: 'setFilterModeOnce'
},
ldap_userfilter_groups: {
$element: $('#ldap_userfilter_groups'),