Set the meta data before everything
Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
parent
e47d627fc4
commit
95ecab0356
|
@ -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('/');
|
||||
}
|
||||
|
||||
$emailTemplate = $this->mailer->createEMailTemplate();
|
||||
$emailTemplate->addHeader();
|
||||
$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();
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue