aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnna Larch <anna@nextcloud.com>2024-12-17 14:49:49 +0100
committerAnna <anna@nextcloud.com>2025-01-13 14:13:02 +0100
commit236e084fbb252d4133803e8c66e28d3544ba4415 (patch)
tree5a4ee3de665f4f8394de914c41e429da6cea0226
parent9c717aa701af31ca3c3bbbed4513603840d4f895 (diff)
downloadnextcloud-server-236e084fbb252d4133803e8c66e28d3544ba4415.tar.gz
nextcloud-server-236e084fbb252d4133803e8c66e28d3544ba4415.zip
fix(sharing): send share emails for internal users toofix/noid/no-emails-for-user-shares
Signed-off-by: Anna Larch <anna@nextcloud.com>
-rw-r--r--apps/files_sharing/lib/Controller/ShareAPIController.php11
1 files changed, 7 insertions, 4 deletions
diff --git a/apps/files_sharing/lib/Controller/ShareAPIController.php b/apps/files_sharing/lib/Controller/ShareAPIController.php
index ff20a0acf3c..6e796ed7f21 100644
--- a/apps/files_sharing/lib/Controller/ShareAPIController.php
+++ b/apps/files_sharing/lib/Controller/ShareAPIController.php
@@ -661,10 +661,13 @@ class ShareAPIController extends OCSController {
// 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');