diff options
author | Julius Härtl <jus@bitgrid.net> | 2021-11-26 14:42:31 +0100 |
---|---|---|
committer | Julius Härtl <jus@bitgrid.net> | 2021-12-03 10:17:02 +0100 |
commit | 5116bf146f3e21805d42997ca9b1f713474bfb6d (patch) | |
tree | f0b0fc2d88f905d22a1331f9ebd85aee792c8522 /lib | |
parent | 70f9e5e37dde34a976d7aab1a9cdeec165cb5df1 (diff) | |
download | nextcloud-server-5116bf146f3e21805d42997ca9b1f713474bfb6d.tar.gz nextcloud-server-5116bf146f3e21805d42997ca9b1f713474bfb6d.zip |
Allow to pass note when creating a share and send it with directly in the share mail when set
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/Share20/DefaultShareProvider.php | 4 | ||||
-rw-r--r-- | lib/private/Share20/Manager.php | 10 |
2 files changed, 12 insertions, 2 deletions
diff --git a/lib/private/Share20/DefaultShareProvider.php b/lib/private/Share20/DefaultShareProvider.php index a6a8bdb9698..ec0f25cbae5 100644 --- a/lib/private/Share20/DefaultShareProvider.php +++ b/lib/private/Share20/DefaultShareProvider.php @@ -202,6 +202,10 @@ class DefaultShareProvider implements IShareProvider { // Set the file target $qb->setValue('file_target', $qb->createNamedParameter($share->getTarget())); + if ($share->getNote() !== '') { + $qb->setValue('note', $qb->createNamedParameter($share->getNote())); + } + // Set the time this share was created $qb->setValue('stime', $qb->createNamedParameter(time())); diff --git a/lib/private/Share20/Manager.php b/lib/private/Share20/Manager.php index 1891e3a1283..2aa4d099024 100644 --- a/lib/private/Share20/Manager.php +++ b/lib/private/Share20/Manager.php @@ -852,7 +852,8 @@ class Manager implements IManager { $this->urlGenerator->linkToRouteAbsolute('files_sharing.Accept.accept', ['shareId' => $share->getFullId()]), $share->getSharedBy(), $emailAddress, - $share->getExpirationDate() + $share->getExpirationDate(), + $share->getNote() ); $this->logger->debug('Sent share notification to ' . $emailAddress . ' for share with ID ' . $share->getId(), ['app' => 'share']); } else { @@ -886,7 +887,8 @@ class Manager implements IManager { $link, $initiator, $shareWith, - \DateTime $expiration = null) { + \DateTime $expiration = null, + $note = '') { $initiatorUser = $this->userManager->get($initiator); $initiatorDisplayName = ($initiatorUser instanceof IUser) ? $initiatorUser->getDisplayName() : $initiator; @@ -905,6 +907,10 @@ class Manager implements IManager { $emailTemplate->addHeading($l->t('%1$s shared »%2$s« with you', [$initiatorDisplayName, $filename]), false); $text = $l->t('%1$s shared »%2$s« with you.', [$initiatorDisplayName, $filename]); + if ($note !== '') { + $emailTemplate->addBodyText(htmlspecialchars($note), $note); + } + $emailTemplate->addBodyText( htmlspecialchars($text . ' ' . $l->t('Click the button below to open it.')), $text |