diff options
author | Morris Jobke <hey@morrisjobke.de> | 2017-09-05 16:08:57 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-05 16:08:57 +0200 |
commit | 15cd21d252b9da706be817df77e4c0643b40327f (patch) | |
tree | a38c9c53c35c3a40fbd8ee2bf2c5d05fac586918 /lib/private | |
parent | cebbb1633aab6c1dfb20be9b49212b934c3b5e68 (diff) | |
parent | 4e3c39c1d1210b6216462e8e26db93f65a4767e6 (diff) | |
download | nextcloud-server-15cd21d252b9da706be817df77e4c0643b40327f.tar.gz nextcloud-server-15cd21d252b9da706be817df77e4c0643b40327f.zip |
Merge pull request #6358 from nextcloud/fix-mixup-of-id-and-name
Set the meta data before everything
Diffstat (limited to 'lib/private')
-rw-r--r-- | lib/private/Mail/EMailTemplate.php | 16 | ||||
-rw-r--r-- | lib/private/Mail/Mailer.php | 19 | ||||
-rw-r--r-- | lib/private/Share20/Manager.php | 3 |
3 files changed, 22 insertions, 16 deletions
diff --git a/lib/private/Mail/EMailTemplate.php b/lib/private/Mail/EMailTemplate.php index 32cb01f30b3..da3341b6709 100644 --- a/lib/private/Mail/EMailTemplate.php +++ b/lib/private/Mail/EMailTemplate.php @@ -342,24 +342,18 @@ EOF; * @param Defaults $themingDefaults * @param IURLGenerator $urlGenerator * @param IL10N $l10n + * @param string $emailId + * @param array $data */ public function __construct(Defaults $themingDefaults, IURLGenerator $urlGenerator, - IL10N $l10n) { + IL10N $l10n, + $emailId, + array $data) { $this->themingDefaults = $themingDefaults; $this->urlGenerator = $urlGenerator; $this->l10n = $l10n; $this->htmlBody .= $this->head; - } - - /** - * 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; } diff --git a/lib/private/Mail/Mailer.php b/lib/private/Mail/Mailer.php index d232587df63..45405157d26 100644 --- a/lib/private/Mail/Mailer.php +++ b/lib/private/Mail/Mailer.php @@ -26,6 +26,7 @@ use OCP\Defaults; use OCP\IConfig; use OCP\IL10N; use OCP\IURLGenerator; +use OCP\Mail\IEMailTemplate; use OCP\Mail\IMailer; use OCP\ILogger; @@ -89,21 +90,33 @@ class Mailer implements IMailer { return new Message(new \Swift_Message()); } - public function createEMailTemplate() { + /** + * Creates a new email template object + * + * @param string $emailId + * @param array $data + * @return IEMailTemplate + * @since 12.0.0 + */ + public function createEMailTemplate($emailId, array $data = []) { $class = $this->config->getSystemValue('mail_template_class', ''); if ($class !== '' && class_exists($class) && is_a($class, EMailTemplate::class, true)) { return new $class( $this->defaults, $this->urlGenerator, - $this->l10n + $this->l10n, + $emailId, + $data ); } return new EMailTemplate( $this->defaults, $this->urlGenerator, - $this->l10n + $this->l10n, + $emailId, + $data ); } diff --git a/lib/private/Share20/Manager.php b/lib/private/Share20/Manager.php index 46e3bd75c5c..886a319b1e7 100644 --- a/lib/private/Share20/Manager.php +++ b/lib/private/Share20/Manager.php @@ -696,8 +696,7 @@ class Manager implements IManager { $message = $this->mailer->createMessage(); - $emailTemplate = $this->mailer->createEMailTemplate(); - $emailTemplate->setMetaData('files_sharing.RecipientNotification', [ + $emailTemplate = $this->mailer->createEMailTemplate('files_sharing.RecipientNotification', [ 'filename' => $filename, 'link' => $link, 'initiator' => $initiatorDisplayName, |