diff options
author | Joas Schilling <coding@schilljs.com> | 2017-09-04 14:46:05 +0200 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2017-09-04 14:46:05 +0200 |
commit | 95ecab03568f2865b166a12156709d8271f7c9be (patch) | |
tree | 98c2e63860b1eb09519083790d71e9fba189b3eb /settings/Mailer | |
parent | e47d627fc428545de5d7382c58ce38998376e3c3 (diff) | |
download | nextcloud-server-95ecab03568f2865b166a12156709d8271f7c9be.tar.gz nextcloud-server-95ecab03568f2865b166a12156709d8271f7c9be.zip |
Set the meta data before everything
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'settings/Mailer')
-rw-r--r-- | settings/Mailer/NewUserMailHelper.php | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/settings/Mailer/NewUserMailHelper.php b/settings/Mailer/NewUserMailHelper.php index c4c09653370..cee684d1cbf 100644 --- a/settings/Mailer/NewUserMailHelper.php +++ b/settings/Mailer/NewUserMailHelper.php @@ -21,7 +21,6 @@ namespace OC\Settings\Mailer; -use OC\Mail\EMailTemplate; use OCP\Mail\IEMailTemplate; use OCP\AppFramework\Utility\ITimeFactory; use OCP\Defaults; @@ -96,7 +95,7 @@ class NewUserMailHelper { /** * @param IUser $user * @param bool $generatePasswordResetToken - * @return EMailTemplate + * @return IEMailTemplate */ public function generateTemplate(IUser $user, $generatePasswordResetToken = false) { if ($generatePasswordResetToken) { @@ -114,11 +113,19 @@ class NewUserMailHelper { } else { $link = $this->urlGenerator->getAbsoluteURL('/'); } + $displayName = $user->getDisplayName(); + $userId = $user->getUID(); $emailTemplate = $this->mailer->createEMailTemplate(); + $emailTemplate->setMetaData('settings.Welcome', [ + 'link' => $link, + 'displayname' => $displayName, + 'userid' => $userId, + 'instancename' => $this->themingDefaults->getName(), + 'resetTokenGenerated' => $generatePasswordResetToken, + ]); + $emailTemplate->addHeader(); - $displayName = $user->getDisplayName(); - $userId = $user->getUID(); if ($displayName === $userId) { $emailTemplate->addHeading($this->l10n->t('Welcome aboard')); } else { @@ -139,14 +146,6 @@ class NewUserMailHelper { ); $emailTemplate->addFooter(); - $emailTemplate->setMetaData('settings.Welcome', [ - 'link' => $link, - 'displayname' => $displayName, - 'userid' => $userId, - 'instancename' => $this->themingDefaults->getName(), - 'resetTokenGenerated' => $generatePasswordResetToken, - ]); - return $emailTemplate; } |