disable checkboxes during save op to avoid race conditions

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
This commit is contained in:
Arthur Schiwon 2016-12-02 13:14:25 +01:00 committed by Bjoern Schiessle
parent 056e59af7e
commit 3ac8d422de
No known key found for this signature in database
GPG Key ID: 2378A753E2BF04F6
2 changed files with 17 additions and 2 deletions

View File

@ -437,7 +437,18 @@
permissions |= $(checkbox).data('permissions');
});
this.model.updateShare(shareId, {permissions: permissions});
/** disable checkboxes during save operation to avoid race conditions **/
$li.find('input[type=checkbox]').prop('disabled', true);
var enableCb = function() {
$li.find('input[type=checkbox]').prop('disabled', false);
};
var errorCb = function(elem, msg) {
OC.dialogs.alert(msg, t('core', 'Error while sharing'));
enableCb();
};
this.model.updateShare(shareId, {permissions: permissions}, {error: errorCb, success: enableCb});
this._renderPermissionChange = shareId;
},

View File

@ -573,7 +573,7 @@
return superShare;
},
fetch: function() {
fetch: function(options) {
var model = this;
this.trigger('request', this);
@ -597,6 +597,10 @@
shares: sharesMap,
reshare: reshare
}));
if(!_.isUndefined(options) && _.isFunction(options.success)) {
options.success();
}
});
return deferred;