Merge pull request #22358 from owncloud/fix-22278

Fix race condition when switching filter mode. Fixes #22278
This commit is contained in:
Thomas Müller 2016-02-15 12:02:35 +01:00
commit fd21bfd9e8
4 changed files with 32 additions and 5 deletions

View File

@ -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;
@ -407,6 +413,20 @@ OCA = OCA || {};
this.configModel.requestWizard(this.filterName);
},
/**
* 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
*
@ -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();
});
},
});

View File

@ -26,7 +26,7 @@ OCA = OCA || {};
featureName: 'GroupObjectClasses'
},
ldap_group_filter_mode: {
setMethod: 'setFilterMode'
setMethod: 'setFilterModeOnce'
},
ldap_groupfilter_groups: {
$element: $('#ldap_groupfilter_groups'),

View File

@ -32,7 +32,7 @@ OCA = OCA || {};
setMethod: 'setLoginAttributeEmail'
},
ldap_login_filter_mode: {
setMethod: 'setFilterMode'
setMethod: 'setFilterModeOnce'
},
ldap_loginfilter_attributes: {
$element: $('#ldap_loginfilter_attributes'),

View File

@ -26,7 +26,7 @@ OCA = OCA || {};
featureName: 'UserObjectClasses'
},
ldap_user_filter_mode: {
setMethod: 'setFilterMode'
setMethod: 'setFilterModeOnce'
},
ldap_userfilter_groups: {
$element: $('#ldap_userfilter_groups'),