diff --git a/apps/files/index.php b/apps/files/index.php index 4142a02b97..fbc31ac6bb 100644 --- a/apps/files/index.php +++ b/apps/files/index.php @@ -120,6 +120,7 @@ $tmpl->assign('usedSpacePercent', (int)$storageInfo['relative']); $tmpl->assign('isPublic', false); $tmpl->assign("encryptedFiles", \OCP\Util::encryptedFiles()); $tmpl->assign("mailNotificationEnabled", $config->getAppValue('core', 'shareapi_allow_mail_notification', 'no')); +$tmpl->assign("mailPublicNotificationEnabled", $config->getAppValue('core', 'shareapi_allow_public_notification', 'no')); $tmpl->assign("allowShareWithLink", $config->getAppValue('core', 'shareapi_allow_links', 'yes')); $tmpl->assign("encryptionInitStatus", $encryptionInitStatus); $tmpl->assign('appNavigation', $nav); diff --git a/apps/files/templates/index.php b/apps/files/templates/index.php index b52effb1e7..222a996aae 100644 --- a/apps/files/templates/index.php +++ b/apps/files/templates/index.php @@ -15,5 +15,6 @@ + ' + t('core', 'Allow Public Upload') + ''; html += ''; } - html += ''; + html += ''; + var mailPublicNotificationEnabled = $('input:hidden[name=mailPublicNotificationEnabled]').val(); + if (mailPublicNotificationEnabled === 'yes') { + html += ''; + } } html += '
'; @@ -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 e712ea58bc..f714b41dda 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($('
')); // horrible parameters $('#testArea').append(''); + $('#testArea').append(''); $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(); diff --git a/settings/admin.php b/settings/admin.php index bb5f47b36a..56484f25b2 100644 --- a/settings/admin.php +++ b/settings/admin.php @@ -66,6 +66,7 @@ $template->assign('allowLinks', $appConfig->getValue('core', 'shareapi_allow_lin $template->assign('enforceLinkPassword', \OCP\Util::isPublicLinkPasswordRequired()); $template->assign('allowPublicUpload', $appConfig->getValue('core', 'shareapi_allow_public_upload', 'yes')); $template->assign('allowResharing', $appConfig->getValue('core', 'shareapi_allow_resharing', 'yes')); +$template->assign('allowPublicMailNotification', $appConfig->getValue('core', 'shareapi_allow_public_notification', 'no')); $template->assign('allowMailNotification', $appConfig->getValue('core', 'shareapi_allow_mail_notification', 'no')); $template->assign('onlyShareWithGroupMembers', \OC\Share\Share::shareWithGroupMembersOnly()); $databaseOverload = (strpos(\OCP\Config::getSystemValue('dbtype'), 'sqlite') !== false); diff --git a/settings/templates/admin.php b/settings/templates/admin.php index a2380a9265..d04351c2d6 100644 --- a/settings/templates/admin.php +++ b/settings/templates/admin.php @@ -271,10 +271,15 @@ if ($_['suggestedOverwriteWebroot']) { />
+ />
+ /> +
+ />
@@ -302,7 +307,7 @@ if ($_['suggestedOverwriteWebroot']) {

/> -
+