summaryrefslogtreecommitdiffstats
path: root/lib/private
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2017-08-26 18:53:52 +0200
committerGitHub <noreply@github.com>2017-08-26 18:53:52 +0200
commit2bf15eda2610b2a06dabe3f3b6ae0675a9980ec4 (patch)
tree79118c39f031e8bbbf2f18ad295a1b19bf01b72d /lib/private
parent0b652648cc698d3b5c2979ccb7f1d1544057294d (diff)
parentf0c34a3e89907cab471dcc35b9eebae8d60ca598 (diff)
downloadnextcloud-server-2bf15eda2610b2a06dabe3f3b6ae0675a9980ec4.tar.gz
nextcloud-server-2bf15eda2610b2a06dabe3f3b6ae0675a9980ec4.zip
Merge pull request #6255 from nextcloud/email-meta-data
Add meta information to emails for better customisation
Diffstat (limited to 'lib/private')
-rw-r--r--lib/private/Mail/EMailTemplate.php16
-rw-r--r--lib/private/Share20/Manager.php13
2 files changed, 27 insertions, 2 deletions
diff --git a/lib/private/Mail/EMailTemplate.php b/lib/private/Mail/EMailTemplate.php
index a55e6f9e5b5..32cb01f30b3 100644
--- a/lib/private/Mail/EMailTemplate.php
+++ b/lib/private/Mail/EMailTemplate.php
@@ -45,6 +45,10 @@ class EMailTemplate implements IEMailTemplate {
protected $urlGenerator;
/** @var IL10N */
protected $l10n;
+ /** @var string */
+ protected $emailId;
+ /** @var array */
+ protected $data;
/** @var string */
protected $htmlBody = '';
@@ -349,6 +353,18 @@ EOF;
}
/**
+ * Set meta data of an email
+ *
+ * @param string $emailId
+ * @param array $data
+ * @since 12.0.3
+ */
+ public function setMetaData($emailId, array $data = []) {
+ $this->emailId = $emailId;
+ $this->data = $data;
+ }
+
+ /**
* Adds a header to the email
*/
public function addHeader() {
diff --git a/lib/private/Share20/Manager.php b/lib/private/Share20/Manager.php
index d722b5c923a..7139d7646d4 100644
--- a/lib/private/Share20/Manager.php
+++ b/lib/private/Share20/Manager.php
@@ -662,7 +662,8 @@ class Manager implements IManager {
$share->getNode()->getName(),
$this->urlGenerator->linkToRouteAbsolute('files.viewcontroller.showFile', [ 'fileid' => $share->getNode()->getId() ]),
$share->getSharedBy(),
- $emailAddress
+ $emailAddress,
+ $share->getExpirationDate()
);
$this->logger->debug('Send share notification to ' . $emailAddress . ' for share with ID ' . $share->getId(), ['app' => 'share']);
} else {
@@ -681,12 +682,14 @@ class Manager implements IManager {
* @param string $link link to the file/folder
* @param string $initiator user ID of share sender
* @param string $shareWith email address of share receiver
+ * @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));
@@ -694,6 +697,12 @@ class Manager implements IManager {
$message = $this->mailer->createMessage();
$emailTemplate = $this->mailer->createEMailTemplate();
+ $emailTemplate->setMetaData('files_sharing.RecipientNotification', [
+ 'filename' => $filename,
+ 'link' => $link,
+ 'initiator' => $initiatorDisplayName,
+ 'expiration' => $expiration,
+ ]);
$emailTemplate->addHeader();
$emailTemplate->addHeading($this->l->t('%s shared »%s« with you', [$initiatorDisplayName, $filename]), false);