Skip to content

Commit d9a7124

Browse files
authored
Merge pull request #49898 from nextcloud/fix/noid/no-emails-for-user-shares
fix(sharing): send share emails for internal users too
2 parents a0b7dc9 + 236e084 commit d9a7124

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

apps/files_sharing/lib/Controller/ShareAPIController.php

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

664664
// Handle mail send
665665
if (is_null($sendMail)) {
666-
// Define a default behavior when sendMail is not provided
667-
// For email shares with a valid recipient, the default is to send the mail
668-
// For all other share types, the default is to not send the mail
669-
$allowSendMail = ($shareType === IShare::TYPE_EMAIL && $shareWith !== null && $shareWith !== '');
666+
$allowSendMail = $this->config->getSystemValueBool('sharing.enable_share_mail', true);
667+
if ($allowSendMail !== true || $shareType === IShare::TYPE_EMAIL) {
668+
// Define a default behavior when sendMail is not provided
669+
// For email shares with a valid recipient, the default is to send the mail
670+
// For all other share types, the default is to not send the mail
671+
$allowSendMail = ($shareType === IShare::TYPE_EMAIL && $shareWith !== null && $shareWith !== '');
672+
}
670673
$share->setMailSend($allowSendMail);
671674
} else {
672675
$share->setMailSend($sendMail === 'true');

0 commit comments

Comments
 (0)