From e17b91c0ebbee3f3f4eb2a1c56153b391670fc2b Mon Sep 17 00:00:00 2001 From: Anna Larch Date: Tue, 17 Dec 2024 14:49:49 +0100 Subject: [PATCH] fix(sharing): send share emails for internal users too Signed-off-by: Anna Larch --- .../lib/Controller/ShareAPIController.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/apps/files_sharing/lib/Controller/ShareAPIController.php b/apps/files_sharing/lib/Controller/ShareAPIController.php index ff20a0acf3cc3..6e796ed7f2189 100644 --- a/apps/files_sharing/lib/Controller/ShareAPIController.php +++ b/apps/files_sharing/lib/Controller/ShareAPIController.php @@ -661,10 +661,13 @@ public function createShare( // Handle mail send if (is_null($sendMail)) { - // Define a default behavior when sendMail is not provided - // For email shares with a valid recipient, the default is to send the mail - // For all other share types, the default is to not send the mail - $allowSendMail = ($shareType === IShare::TYPE_EMAIL && $shareWith !== null && $shareWith !== ''); + $allowSendMail = $this->config->getSystemValueBool('sharing.enable_share_mail', true); + if ($allowSendMail !== true || $shareType === IShare::TYPE_EMAIL) { + // Define a default behavior when sendMail is not provided + // For email shares with a valid recipient, the default is to send the mail + // For all other share types, the default is to not send the mail + $allowSendMail = ($shareType === IShare::TYPE_EMAIL && $shareWith !== null && $shareWith !== ''); + } $share->setMailSend($allowSendMail); } else { $share->setMailSend($sendMail === 'true');