summaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/js
diff options
context:
space:
mode:
authorMichael Gapczynski <mtgap@owncloud.com>2012-07-29 18:01:43 -0400
committerMichael Gapczynski <mtgap@owncloud.com>2012-07-29 18:02:09 -0400
commit5262cde6a6dbf7c924508423093aaac0d17a95b5 (patch)
tree48a304fb2fad15f907fe3806c30eb0c869f5cc19 /apps/files_sharing/js
parente18639551d4c2915af706c70f98c67aa04b9c89e (diff)
downloadnextcloud-server-5262cde6a6dbf7c924508423093aaac0d17a95b5.tar.gz
nextcloud-server-5262cde6a6dbf7c924508423093aaac0d17a95b5.zip
Add additional error handling for emailing private links
Diffstat (limited to 'apps/files_sharing/js')
-rw-r--r--apps/files_sharing/js/share.js18
1 files changed, 13 insertions, 5 deletions
diff --git a/apps/files_sharing/js/share.js b/apps/files_sharing/js/share.js
index 39e6bd78590..3cfa3583b13 100644
--- a/apps/files_sharing/js/share.js
+++ b/apps/files_sharing/js/share.js
@@ -202,11 +202,19 @@ OC.Share={
emailPrivateLink:function() {
var link = $('#privateLinkText').val();
var file = link.substr(link.lastIndexOf('/') + 1).replace(/%20/g, ' ');
- $.post(OC.filePath('files_sharing', 'ajax', 'email.php'), { toaddress: $('#email').val(), link: link, file: file } );
- $('#email').css('font-weight', 'bold');
- $('#email').animate({ fontWeight: 'normal' }, 2000, function() {
- $(this).val('');
- }).val('Email sent');
+ var email = $('#email').val();
+ if (email != '') {
+ $.post(OC.filePath('files_sharing', 'ajax', 'email.php'), { toaddress: email, link: link, file: file }, function(result) {
+ if (result && result.status == 'success') {
+ $('#email').css('font-weight', 'bold');
+ $('#email').animate({ fontWeight: 'normal' }, 2000, function() {
+ $(this).val('');
+ }).val('Email sent');
+ } else {
+ OC.dialogs.alert(result.data.message, 'Error while sharing');
+ }
+ });
+ }
},
dirname:function(path) {
return path.replace(/\\/g,'/').replace(/\/[^\/]*$/, '');