Merge pull request #17827 from owncloud/dont-set-share-password-twice-master-2
Adding error handling in case setting the password fails
This commit is contained in:
commit
01b7e306c4
|
@ -308,7 +308,7 @@ OC.Share={
|
||||||
|
|
||||||
return data;
|
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.
|
// Add a fallback for old share() calls without expirationDate.
|
||||||
// We should remove this in a later version,
|
// We should remove this in a later version,
|
||||||
// after the Apps have been updated.
|
// after the Apps have been updated.
|
||||||
|
@ -339,12 +339,15 @@ OC.Share={
|
||||||
callback(result.data);
|
callback(result.data);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (result.data && result.data.message) {
|
if (_.isUndefined(errorCallback)) {
|
||||||
var msg = result.data.message;
|
|
||||||
} else {
|
|
||||||
var msg = t('core', 'Error');
|
var msg = t('core', 'Error');
|
||||||
|
if (result.data && result.data.message) {
|
||||||
|
msg = result.data.message;
|
||||||
}
|
}
|
||||||
OC.dialogs.alert(msg, t('core', 'Error while sharing'));
|
OC.dialogs.alert(msg, t('core', 'Error while sharing'));
|
||||||
|
} else {
|
||||||
|
errorCallback(result);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -1178,6 +1181,10 @@ $(document).ready(function() {
|
||||||
OC.Share.updateIcon(itemType, itemSource);
|
OC.Share.updateIcon(itemType, itemSource);
|
||||||
}
|
}
|
||||||
$('#dropdown').trigger(new $.Event('sharesChanged', {shares: OC.Share.currentShares}));
|
$('#dropdown').trigger(new $.Event('sharesChanged', {shares: OC.Share.currentShares}));
|
||||||
|
}, function(result) {
|
||||||
|
$loading.addClass('hidden');
|
||||||
|
linkPassText.val('');
|
||||||
|
linkPassText.attr('placeholder', result.data.message);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (expireDateString !== '') {
|
if (expireDateString !== '') {
|
||||||
|
|
Loading…
Reference in New Issue