From ec00e4b0019cb616b5960e6f1bd77e1f4922ec59 Mon Sep 17 00:00:00 2001 From: Morris Jobke Date: Wed, 30 Aug 2017 22:56:14 +0200 Subject: [PATCH] Implement metadata for email templates of remaining emails Signed-off-by: Morris Jobke --- apps/sharebymail/lib/ShareByMailProvider.php | 14 ++++++++++++++ settings/Controller/MailSettingsController.php | 5 +++++ settings/Hooks.php | 11 +++++++++++ settings/Mailer/NewUserMailHelper.php | 8 ++++++++ 4 files changed, 38 insertions(+) diff --git a/apps/sharebymail/lib/ShareByMailProvider.php b/apps/sharebymail/lib/ShareByMailProvider.php index 1992ed5eb1..02d96b648a 100644 --- a/apps/sharebymail/lib/ShareByMailProvider.php +++ b/apps/sharebymail/lib/ShareByMailProvider.php @@ -462,6 +462,13 @@ class ShareByMailProvider implements IShareProvider { $message = $this->mailer->createMessage(); $emailTemplate = $this->mailer->createEMailTemplate(); + $emailTemplate->setMetaData('sharebymail.RecipientPasswordNotification', [ + 'filename' => $filename, + 'password' => $password, + 'initiator' => $initiatorDisplayName, + 'initiatorEmail' => $initiatorEmailAddress, + 'shareWith' => $shareWith, + ]); $emailTemplate->addHeader(); $emailTemplate->addHeading($this->l->t('Password to access »%s«', [$filename]), false); $emailTemplate->addBodyText($htmlBodyPart, $plainBodyPart); @@ -523,6 +530,13 @@ class ShareByMailProvider implements IShareProvider { $message = $this->mailer->createMessage(); $emailTemplate = $this->mailer->createEMailTemplate(); + $emailTemplate->setMetaData('sharebymail.OwnerPasswordNotification', [ + 'filename' => $filename, + 'password' => $password, + 'initiator' => $initiatorDisplayName, + 'initiatorEmail' => $initiatorEMailAddress, + 'shareWith' => $shareWith, + ]); $emailTemplate->addHeader(); $emailTemplate->addHeading($this->l->t('Password to access »%s«', [$filename]), false); diff --git a/settings/Controller/MailSettingsController.php b/settings/Controller/MailSettingsController.php index de10c077ed..44cece1d65 100644 --- a/settings/Controller/MailSettingsController.php +++ b/settings/Controller/MailSettingsController.php @@ -148,6 +148,11 @@ class MailSettingsController extends Controller { $displayName = $this->userSession->getUser()->getDisplayName(); $template = $this->mailer->createEMailTemplate(); + + $template->setMetaData('settings.TestEmail', [ + 'displayname' => $displayName, + ]); + $template->addHeader(); $template->addHeading($this->l10n->t('Well done, %s!', [$displayName])); $template->addBodyText($this->l10n->t('If you received this email, the email configuration seems to be correct.')); diff --git a/settings/Hooks.php b/settings/Hooks.php index 2cc5ce30bb..242fa5cb66 100644 --- a/settings/Hooks.php +++ b/settings/Hooks.php @@ -118,6 +118,11 @@ class Hooks { if ($user->getEMailAddress() !== null) { $template = $this->mailer->createEMailTemplate(); + $template->setMetaData('settings.PasswordChanged', [ + 'displayname' => $user->getDisplayName(), + 'emailAddress' => $user->getEMailAddress(), + 'instanceUrl' => $instanceUrl, + ]); $template->addHeader(); $template->addHeading($this->l->t('Password changed for %s', $user->getDisplayName()), false); $template->addBodyText($text . ' ' . $this->l->t('If you did not request this, please contact an administrator.')); @@ -184,6 +189,12 @@ class Hooks { if ($oldMailAddress !== null) { $template = $this->mailer->createEMailTemplate(); + $template->setMetaData('settings.EmailChanged', [ + 'displayname' => $user->getDisplayName(), + 'newEMailAddress' => $user->getEMailAddress(), + 'oldEMailAddress' => $oldMailAddress, + 'instanceUrl' => $instanceUrl, + ]); $template->addHeader(); $template->addHeading($this->l->t('Email address changed for %s', $user->getDisplayName()), false); $template->addBodyText($text . ' ' . $this->l->t('If you did not request this, please contact an administrator.')); diff --git a/settings/Mailer/NewUserMailHelper.php b/settings/Mailer/NewUserMailHelper.php index cd6d6ee67f..1571cfdcb4 100644 --- a/settings/Mailer/NewUserMailHelper.php +++ b/settings/Mailer/NewUserMailHelper.php @@ -139,6 +139,14 @@ class NewUserMailHelper { ); $emailTemplate->addFooter(); + $emailTemplate->setMetaData('settings.Welcome', [ + 'link' => $link, + 'displayname' => $displayName, + 'username' => $userName, + 'instancename' => $this->themingDefaults->getName(), + 'resetTokenGenerated' => $generatePasswordResetToken, + ]); + return $emailTemplate; }