From 15cbac0f32148f5f668d55e5c2548be9e6e8919b Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 19 Aug 2020 09:03:58 +0200 Subject: [PATCH] Allow to disable share emails Signed-off-by: Joas Schilling --- config/config.sample.php | 5 +++++ lib/private/Share20/Manager.php | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/config/config.sample.php b/config/config.sample.php index 2c4bb90d232..f90c4ede6d8 100644 --- a/config/config.sample.php +++ b/config/config.sample.php @@ -1349,6 +1349,11 @@ $CONFIG = array( */ 'sharing.force_share_accept' => false, +/** + * Set to false to stop sending a mail when users receive a share + */ +'sharing.enable_share_mail' => true, + /** * All other configuration options diff --git a/lib/private/Share20/Manager.php b/lib/private/Share20/Manager.php index c8ba04a4636..348e0207d2f 100644 --- a/lib/private/Share20/Manager.php +++ b/lib/private/Share20/Manager.php @@ -809,7 +809,8 @@ class Manager implements IManager { $this->dispatcher->dispatchTyped(new Share\Events\ShareCreatedEvent($share)); - if ($share->getShareType() === \OCP\Share::SHARE_TYPE_USER) { + if ($this->config->getSystemValueBool('sharing.enable_share_mail', true) + && $share->getShareType() === \OCP\Share::SHARE_TYPE_USER) { $mailSend = $share->getMailSend(); if($mailSend === true) { $user = $this->userManager->get($share->getSharedWith()); -- 2.39.5