Skip to content

Commit 5839a58

Browse files
authored
Merge pull request #50217 from nextcloud/backport/49898/stable30
2 parents 0e6f3ba + 6af3bec commit 5839a58

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

apps/files_sharing/lib/Controller/ShareAPIController.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -652,10 +652,13 @@ public function createShare(
652652

653653
// Handle mail send
654654
if (is_null($sendMail)) {
655-
// Define a default behavior when sendMail is not provided
656-
// For email shares with a valid recipient, the default is to send the mail
657-
// For all other share types, the default is to not send the mail
658-
$allowSendMail = ($shareType === IShare::TYPE_EMAIL && $shareWith !== null && $shareWith !== '');
655+
$allowSendMail = $this->config->getSystemValueBool('sharing.enable_share_mail', true);
656+
if ($allowSendMail !== true || $shareType === IShare::TYPE_EMAIL) {
657+
// Define a default behavior when sendMail is not provided
658+
// For email shares with a valid recipient, the default is to send the mail
659+
// For all other share types, the default is to not send the mail
660+
$allowSendMail = ($shareType === IShare::TYPE_EMAIL && $shareWith !== null && $shareWith !== '');
661+
}
659662
$share->setMailSend($allowSendMail);
660663
} else {
661664
$share->setMailSend($sendMail === 'true');

0 commit comments

Comments
 (0)