diff options
author | Morris Jobke <hey@morrisjobke.de> | 2014-12-09 14:05:52 +0100 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2014-12-09 14:05:52 +0100 |
commit | bfcd5a3802030ca97836aca1e658aec434162922 (patch) | |
tree | 201c6b78cc22e61f7eb02ee3cffb5aa83068be3b /core | |
parent | f53f25eafe2e7cad28eabccd7ca5acebab488170 (diff) | |
parent | 539c0aeb04f3210654972548f51f8cf61fce49ae (diff) | |
download | nextcloud-server-bfcd5a3802030ca97836aca1e658aec434162922.tar.gz nextcloud-server-bfcd5a3802030ca97836aca1e658aec434162922.zip |
Merge pull request #11214 from owncloud/issue/10836
Add an option to disallow sending sharing emails to non-owncloud users
Diffstat (limited to 'core')
-rw-r--r-- | core/js/share.js | 14 | ||||
-rw-r--r-- | core/js/tests/specs/shareSpec.js | 11 |
2 files changed, 20 insertions, 5 deletions
diff --git a/core/js/share.js b/core/js/share.js index b856363d157..80a2d7d169e 100644 --- a/core/js/share.js +++ b/core/js/share.js @@ -410,10 +410,14 @@ OC.Share={ html += '<label for="sharingDialogAllowPublicUpload">' + t('core', 'Allow Public Upload') + '</label>'; html += '</div>'; } - html += '</div><form id="emailPrivateLink" >'; - html += '<input id="email" style="display:none; width:62%;" value="" placeholder="'+t('core', 'Email link to person')+'" type="text" />'; - html += '<input id="emailButton" style="display:none;" type="submit" value="'+t('core', 'Send')+'" />'; - html += '</form>'; + html += '</div>'; + var mailPublicNotificationEnabled = $('input:hidden[name=mailPublicNotificationEnabled]').val(); + if (mailPublicNotificationEnabled === 'yes') { + html += '<form id="emailPrivateLink">'; + html += '<input id="email" style="display:none; width:62%;" value="" placeholder="'+t('core', 'Email link to person')+'" type="text" />'; + html += '<input id="emailButton" style="display:none;" type="submit" value="'+t('core', 'Send')+'" />'; + html += '</form>'; + } } html += '<div id="expiration">'; @@ -520,7 +524,7 @@ OC.Share={ .append( insert ) .appendTo( ul ); }; - if (link && linksAllowed) { + if (link && linksAllowed && $('#email').length != 0) { $('#email').autocomplete({ minLength: 1, source: function (search, response) { diff --git a/core/js/tests/specs/shareSpec.js b/core/js/tests/specs/shareSpec.js index e712ea58bc2..f714b41dda6 100644 --- a/core/js/tests/specs/shareSpec.js +++ b/core/js/tests/specs/shareSpec.js @@ -31,6 +31,7 @@ describe('OC.Share tests', function() { $('#testArea').append($('<div id="shareContainer"></div>')); // horrible parameters $('#testArea').append('<input id="allowShareWithLink" type="hidden" value="yes">'); + $('#testArea').append('<input id="mailPublicNotificationEnabled" name="mailPublicNotificationEnabled" type="hidden" value="yes">'); $container = $('#shareContainer'); /* jshint camelcase:false */ oldAppConfig = _.extend({}, oc_appconfig.core); @@ -362,6 +363,16 @@ describe('OC.Share tests', function() { $('#dropdown [name=expirationCheckbox]').click(); expect($('#dropdown [name=expirationCheckbox]').prop('checked')).toEqual(true); }); + it('displayes email form when sending emails is enabled', function() { + $('input[name=mailPublicNotificationEnabled]').val('yes'); + showDropDown(); + expect($('#emailPrivateLink').length).toEqual(1); + }); + it('not renders email form when sending emails is disabled', function() { + $('input[name=mailPublicNotificationEnabled]').val('no'); + showDropDown(); + expect($('#emailPrivateLink').length).toEqual(0); + }); it('sets picker minDate to today and no maxDate by default', function() { showDropDown(); $('#dropdown [name=linkCheckbox]').click(); |