diff options
author | Vincent Petry <pvince81@owncloud.com> | 2013-12-06 17:23:51 +0100 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2013-12-06 17:25:09 +0100 |
commit | e13be94e56ec59d92b6c9cf67b7a17bd03438efb (patch) | |
tree | fa297d8540bcfc41a7edcb681eeab897e5e29922 /apps/files_external/js/dropbox.js | |
parent | 4dd84b3627d5667b61638363244621ad93a5632f (diff) | |
download | nextcloud-server-e13be94e56ec59d92b6c9cf67b7a17bd03438efb.tar.gz nextcloud-server-e13be94e56ec59d92b6c9cf67b7a17bd03438efb.zip |
Fixed Dropbox/Google storage async save call
When clicking "Grant access", the settings for Dropbox/Google were saved
through a call that gets cancelled when redirecting to the grant page
(for example in Firefox)
This fix makes sure the "save settings" call finished before redirecting
to the grant page.
Fixes #6176
Diffstat (limited to 'apps/files_external/js/dropbox.js')
-rw-r--r-- | apps/files_external/js/dropbox.js | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/apps/files_external/js/dropbox.js b/apps/files_external/js/dropbox.js index 957daeb4d1f..6baaabe11b6 100644 --- a/apps/files_external/js/dropbox.js +++ b/apps/files_external/js/dropbox.js @@ -23,9 +23,12 @@ $(document).ready(function() { $(token).val(result.access_token); $(token_secret).val(result.access_token_secret); $(configured).val('true'); - OC.MountConfig.saveStorage(tr); - $(tr).find('.configuration input').attr('disabled', 'disabled'); - $(tr).find('.configuration').append('<span id="access" style="padding-left:0.5em;">'+t('files_external', 'Access granted')+'</span>'); + OC.MountConfig.saveStorage(tr, function(status) { + if (status) { + $(tr).find('.configuration input').attr('disabled', 'disabled'); + $(tr).find('.configuration').append('<span id="access" style="padding-left:0.5em;">'+t('files_external', 'Access granted')+'</span>'); + } + }); } else { OC.dialogs.alert(result.data.message, t('files_external', 'Error configuring Dropbox storage')); } @@ -77,7 +80,6 @@ $(document).ready(function() { var tr = $(this).parent().parent(); var app_key = $(this).parent().find('[data-parameter="app_key"]').val(); var app_secret = $(this).parent().find('[data-parameter="app_secret"]').val(); - var statusSpan = $(tr).find('.status span'); if (app_key != '' && app_secret != '') { var tr = $(this).parent().parent(); var configured = $(this).parent().find('[data-parameter="configured"]'); @@ -88,10 +90,9 @@ $(document).ready(function() { $(configured).val('false'); $(token).val(result.data.request_token); $(token_secret).val(result.data.request_token_secret); - OC.MountConfig.saveStorage(tr); - statusSpan.removeClass(); - statusSpan.addClass('waiting'); - window.location = result.data.url; + OC.MountConfig.saveStorage(tr, function() { + window.location = result.data.url; + }); } else { OC.dialogs.alert(result.data.message, t('files_external', 'Error configuring Dropbox storage')); } |