From 09747b296ac48789bf636d230afd5e4499166838 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 24 Aug 2017 17:54:22 +0200 Subject: Add meta information to emails for better customisation Signed-off-by: Joas Schilling --- apps/sharebymail/lib/ShareByMailProvider.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'apps/sharebymail') 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); -- cgit v1.2.3