diff options
author | Julius Härtl <jus@bitgrid.net> | 2021-12-06 08:59:51 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-06 08:59:51 +0100 |
commit | 00549f78026108219ed77c4277cf6382a9a2101e (patch) | |
tree | 91db6593bb9009077450b1ddb15897781d837323 /lib | |
parent | f0e1621eed1ab30acd156ccaf9e513f29a7e3561 (diff) | |
parent | 5116bf146f3e21805d42997ca9b1f713474bfb6d (diff) | |
download | nextcloud-server-00549f78026108219ed77c4277cf6382a9a2101e.tar.gz nextcloud-server-00549f78026108219ed77c4277cf6382a9a2101e.zip |
Merge pull request #30055 from nextcloud/enh/note-share-api
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 |