aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_sharing
diff options
context:
space:
mode:
authorfenn-cs <fenn25.fn@gmail.com>2024-09-26 13:00:52 +0200
committerfenn-cs <fenn25.fn@gmail.com>2024-10-24 14:41:07 +0100
commite2d2a178100ddddc5bfc1ed2ae2f156aef8c335e (patch)
treec14b7c74e83a93428bba41b79e31b30aaaa048cf /apps/files_sharing
parent4176708797c019ff4d87f7ea49c915232fb95b1a (diff)
downloadnextcloud-server-e2d2a178100ddddc5bfc1ed2ae2f156aef8c335e.tar.gz
nextcloud-server-e2d2a178100ddddc5bfc1ed2ae2f156aef8c335e.zip
fix(ShareAPI): Send mails for mail shares by defaultfix/48012/fix-share-email-send-mail-share
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 : https://github.com/nextcloud/server/issues/48012 Signed-off-by: fenn-cs <fenn25.fn@gmail.com>
Diffstat (limited to 'apps/files_sharing')
-rw-r--r--apps/files_sharing/lib/Controller/ShareAPIController.php11
1 files changed, 10 insertions, 1 deletions
diff --git a/apps/files_sharing/lib/Controller/ShareAPIController.php b/apps/files_sharing/lib/Controller/ShareAPIController.php
index 2874d35caa5..ebe40b7edd9 100644
--- a/apps/files_sharing/lib/Controller/ShareAPIController.php
+++ b/apps/files_sharing/lib/Controller/ShareAPIController.php
@@ -659,7 +659,16 @@ class ShareAPIController extends OCSController {
$this->checkInheritedAttributes($share);
// Handle mail send
- if ($sendMail === 'true' || $sendMail === 'false') {
+ if (is_null($sendMail)) {
+ // Define a default behavior when sendMail is not provided
+ if ($shareType === IShare::TYPE_EMAIL && strlen($shareWith) !== 0) {
+ // For email shares, the default is to send the mail
+ $share->setMailSend(true);
+ } else {
+ // For all other share types, the default is to not send the mail
+ $share->setMailSend(false);
+ }
+ } else {
$share->setMailSend($sendMail === 'true');
}