aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorfenn-cs <fenn25.fn@gmail.com>2024-09-26 13:00:52 +0200
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>2024-10-24 16:29:20 +0000
commit0f2013d24fd709bc9324d833259bf49cb0707c3e (patch)
tree2f9d562ee4ba2d7f8d32792a91cf9d2c90bc285a /apps
parente200099f8296d8674c39c2599ac2822524e579af (diff)
downloadnextcloud-server-0f2013d24fd709bc9324d833259bf49cb0707c3e.tar.gz
nextcloud-server-0f2013d24fd709bc9324d833259bf49cb0707c3e.zip
fix(ShareAPI): Send mails for mail shares by defaultbackport/48381/stable30
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')
-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 1be1fdbbde9..0d825deea9e 100644
--- a/apps/files_sharing/lib/Controller/ShareAPIController.php
+++ b/apps/files_sharing/lib/Controller/ShareAPIController.php
@@ -658,7 +658,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');
}