Skip to content

Commit e2d2a17

Browse files
committed
fix(ShareAPI): Send mails for mail shares by default
It looks like, the frontend it needs to provide the `sendMail` param for the backend to decide wether mails would be sent. Our UI does not have that at the moment so it should default to sending emails always for mail shares. Not exactly sure how this was handled earlier but this is a good starting point. Resolves : #48012 Signed-off-by: fenn-cs <[email protected]>
1 parent 4176708 commit e2d2a17

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

apps/files_sharing/lib/Controller/ShareAPIController.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -659,7 +659,16 @@ public function createShare(
659659
$this->checkInheritedAttributes($share);
660660

661661
// Handle mail send
662-
if ($sendMail === 'true' || $sendMail === 'false') {
662+
if (is_null($sendMail)) {
663+
// Define a default behavior when sendMail is not provided
664+
if ($shareType === IShare::TYPE_EMAIL && strlen($shareWith) !== 0) {
665+
// For email shares, the default is to send the mail
666+
$share->setMailSend(true);
667+
} else {
668+
// For all other share types, the default is to not send the mail
669+
$share->setMailSend(false);
670+
}
671+
} else {
663672
$share->setMailSend($sendMail === 'true');
664673
}
665674

0 commit comments

Comments
 (0)