summaryrefslogtreecommitdiffstats
path: root/apps/sharebymail
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2017-08-24 17:54:22 +0200
committerJoas Schilling <coding@schilljs.com>2017-08-24 17:54:22 +0200
commit09747b296ac48789bf636d230afd5e4499166838 (patch)
treea36750d64b7bf4ed0b95175a1e99267bffe18007 /apps/sharebymail
parenta7f2dc6dd660179682f7d03ac8e07649b59cdd6f (diff)
downloadnextcloud-server-09747b296ac48789bf636d230afd5e4499166838.tar.gz
nextcloud-server-09747b296ac48789bf636d230afd5e4499166838.zip
Add meta information to emails for better customisation
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'apps/sharebymail')
-rw-r--r--apps/sharebymail/lib/ShareByMailProvider.php13
1 files changed, 11 insertions, 2 deletions
diff --git a/apps/sharebymail/lib/ShareByMailProvider.php b/apps/sharebymail/lib/ShareByMailProvider.php
index 32fa51d94a2..5538a94bee2 100644
--- a/apps/sharebymail/lib/ShareByMailProvider.php
+++ b/apps/sharebymail/lib/ShareByMailProvider.php
@@ -347,7 +347,8 @@ class ShareByMailProvider implements IShareProvider {
$share->getNode()->getName(),
$link,
$share->getSharedBy(),
- $share->getSharedWith()
+ $share->getSharedWith(),
+ $share->getExpirationDate()
);
} catch (HintException $hintException) {
$this->logger->error('Failed to send share by mail: ' . $hintException->getMessage());
@@ -369,12 +370,14 @@ class ShareByMailProvider implements IShareProvider {
* @param string $link
* @param string $initiator
* @param string $shareWith
+ * @param \DateTime $expiration
* @throws \Exception If mail couldn't be sent
*/
protected function sendMailNotification($filename,
$link,
$initiator,
- $shareWith) {
+ $shareWith,
+ \DateTime $expiration) {
$initiatorUser = $this->userManager->get($initiator);
$initiatorDisplayName = ($initiatorUser instanceof IUser) ? $initiatorUser->getDisplayName() : $initiator;
$subject = (string)$this->l->t('%s shared »%s« with you', array($initiatorDisplayName, $filename));
@@ -382,6 +385,12 @@ class ShareByMailProvider implements IShareProvider {
$message = $this->mailer->createMessage();
$emailTemplate = $this->mailer->createEMailTemplate();
+ $emailTemplate->setMetaData('sharebymail.RecipientNotification', [
+ 'filename' => $filename,
+ 'link' => $link,
+ 'initiator' => $initiatorDisplayName,
+ 'expiration' => $expiration,
+ ]);
$emailTemplate->addHeader();
$emailTemplate->addHeading($this->l->t('%s shared »%s« with you', [$initiatorDisplayName, $filename]), false);