diff options
author | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2016-12-02 13:14:25 +0100 |
---|---|---|
committer | Bjoern Schiessle <bjoern@schiessle.org> | 2016-12-08 10:29:51 +0100 |
commit | 3ac8d422ded4f2bc1064448041cadb4727e2c1ef (patch) | |
tree | 563fc7207bf038c5773a89a3910a349c65bf6764 /core | |
parent | 056e59af7e98a8526739a441e052b5af6d7f8320 (diff) | |
download | nextcloud-server-3ac8d422ded4f2bc1064448041cadb4727e2c1ef.tar.gz nextcloud-server-3ac8d422ded4f2bc1064448041cadb4727e2c1ef.zip |
disable checkboxes during save op to avoid race conditions
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'core')
-rw-r--r-- | core/js/sharedialogshareelistview.js | 13 | ||||
-rw-r--r-- | core/js/shareitemmodel.js | 6 |
2 files changed, 17 insertions, 2 deletions
diff --git a/core/js/sharedialogshareelistview.js b/core/js/sharedialogshareelistview.js index 5f24b236464..74ba6b9746c 100644 --- a/core/js/sharedialogshareelistview.js +++ b/core/js/sharedialogshareelistview.js @@ -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; }, diff --git a/core/js/shareitemmodel.js b/core/js/shareitemmodel.js index 4a82630b967..b01f0f790ac 100644 --- a/core/js/shareitemmodel.js +++ b/core/js/shareitemmodel.js @@ -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; |