summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2015-07-23 16:34:13 +0200
committerThomas Müller <thomas.mueller@tmit.eu>2015-07-23 16:34:13 +0200
commit01b7e306c427f00d1ce4570c3d1bc90f72e25644 (patch)
tree203c5ebd76a3ab57d08c81cbff1d1f1d1fc783bc
parent0e6c4e19024902efcf68e3c444bd8078a3fdab31 (diff)
parentd93535b5cb0cb9339b336162eb22f9cc81bf6d1a (diff)
downloadnextcloud-server-01b7e306c427f00d1ce4570c3d1bc90f72e25644.tar.gz
nextcloud-server-01b7e306c427f00d1ce4570c3d1bc90f72e25644.zip
Merge pull request #17827 from owncloud/dont-set-share-password-twice-master-2
Adding error handling in case setting the password fails
-rw-r--r--core/js/share.js17
1 files changed, 12 insertions, 5 deletions
diff --git a/core/js/share.js b/core/js/share.js
index c0bc2c8ab80..d730d3bbf6e 100644
--- a/core/js/share.js
+++ b/core/js/share.js
@@ -308,7 +308,7 @@ OC.Share={
return data;
},
- share:function(itemType, itemSource, shareType, shareWith, permissions, itemSourceName, expirationDate, callback) {
+ share:function(itemType, itemSource, shareType, shareWith, permissions, itemSourceName, expirationDate, callback, errorCallback) {
// Add a fallback for old share() calls without expirationDate.
// We should remove this in a later version,
// after the Apps have been updated.
@@ -339,12 +339,15 @@ OC.Share={
callback(result.data);
}
} else {
- if (result.data && result.data.message) {
- var msg = result.data.message;
- } else {
+ if (_.isUndefined(errorCallback)) {
var msg = t('core', 'Error');
+ if (result.data && result.data.message) {
+ msg = result.data.message;
+ }
+ OC.dialogs.alert(msg, t('core', 'Error while sharing'));
+ } else {
+ errorCallback(result);
}
- OC.dialogs.alert(msg, t('core', 'Error while sharing'));
}
}
);
@@ -1178,6 +1181,10 @@ $(document).ready(function() {
OC.Share.updateIcon(itemType, itemSource);
}
$('#dropdown').trigger(new $.Event('sharesChanged', {shares: OC.Share.currentShares}));
+ }, function(result) {
+ $loading.addClass('hidden');
+ linkPassText.val('');
+ linkPassText.attr('placeholder', result.data.message);
});
if (expireDateString !== '') {