aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnna Larch <anna@nextcloud.com>2024-12-17 14:49:49 +0100
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>2025-01-16 17:51:52 +0000
commit6af3bec748cf0a9f8b3ef994d04e723f61b6bf91 (patch)
treed0ec3aec3615757ab9e3ac083f707dd00999a711
parent9f2b0f73d7765abc8e31391a19dd838dc2b213f0 (diff)
downloadnextcloud-server-backport/49898/stable30.tar.gz
nextcloud-server-backport/49898/stable30.zip
fix(sharing): send share emails for internal users toobackport/49898/stable30
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 f6c106b9b08..78cf321e50c 100644
--- a/apps/files_sharing/lib/Controller/ShareAPIController.php
+++ b/apps/files_sharing/lib/Controller/ShareAPIController.php
@@ -659,10 +659,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');