aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/lib/Controller
diff options
context:
space:
mode:
authorAnna <anna@nextcloud.com>2025-01-16 18:50:30 +0100
committerGitHub <noreply@github.com>2025-01-16 18:50:30 +0100
commitd9a7124592beaab371d7c39e792f3b3e8d0dd6fa (patch)
treee241ec7856b77a53047264b9e771a5a45058b65a /apps/files_sharing/lib/Controller
parenta0b7dc974f2c234643280756451748c35eeb16c1 (diff)
parent236e084fbb252d4133803e8c66e28d3544ba4415 (diff)
downloadnextcloud-server-d9a7124592beaab371d7c39e792f3b3e8d0dd6fa.tar.gz
nextcloud-server-d9a7124592beaab371d7c39e792f3b3e8d0dd6fa.zip
Merge pull request #49898 from nextcloud/fix/noid/no-emails-for-user-shares
fix(sharing): send share emails for internal users too
Diffstat (limited to 'apps/files_sharing/lib/Controller')
-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 f0b89ab5d47..d2412dd78c2 100644
--- a/apps/files_sharing/lib/Controller/ShareAPIController.php
+++ b/apps/files_sharing/lib/Controller/ShareAPIController.php
@@ -663,10 +663,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');