summaryrefslogtreecommitdiffstats
path: root/settings
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2017-09-05 16:08:57 +0200
committerGitHub <noreply@github.com>2017-09-05 16:08:57 +0200
commit15cd21d252b9da706be817df77e4c0643b40327f (patch)
treea38c9c53c35c3a40fbd8ee2bf2c5d05fac586918 /settings
parentcebbb1633aab6c1dfb20be9b49212b934c3b5e68 (diff)
parent4e3c39c1d1210b6216462e8e26db93f65a4767e6 (diff)
downloadnextcloud-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 'settings')
-rw-r--r--settings/Controller/MailSettingsController.php4
-rw-r--r--settings/Hooks.php6
-rw-r--r--settings/Mailer/NewUserMailHelper.php24
3 files changed, 14 insertions, 20 deletions
diff --git a/settings/Controller/MailSettingsController.php b/settings/Controller/MailSettingsController.php
index 44cece1d658..974a95618ad 100644
--- a/settings/Controller/MailSettingsController.php
+++ b/settings/Controller/MailSettingsController.php
@@ -147,9 +147,7 @@ class MailSettingsController extends Controller {
try {
$displayName = $this->userSession->getUser()->getDisplayName();
- $template = $this->mailer->createEMailTemplate();
-
- $template->setMetaData('settings.TestEmail', [
+ $template = $this->mailer->createEMailTemplate('settings.TestEmail', [
'displayname' => $displayName,
]);
diff --git a/settings/Hooks.php b/settings/Hooks.php
index f97145da0c0..6f537796517 100644
--- a/settings/Hooks.php
+++ b/settings/Hooks.php
@@ -117,8 +117,7 @@ class Hooks {
$this->activityManager->publish($event);
if ($user->getEMailAddress() !== null) {
- $template = $this->mailer->createEMailTemplate();
- $template->setMetaData('settings.PasswordChanged', [
+ $template = $this->mailer->createEMailTemplate('settings.PasswordChanged', [
'displayname' => $user->getDisplayName(),
'emailAddress' => $user->getEMailAddress(),
'instanceUrl' => $instanceUrl,
@@ -188,8 +187,7 @@ class Hooks {
if ($oldMailAddress !== null) {
- $template = $this->mailer->createEMailTemplate();
- $template->setMetaData('settings.EmailChanged', [
+ $template = $this->mailer->createEMailTemplate('settings.EmailChanged', [
'displayname' => $user->getDisplayName(),
'newEMailAddress' => $user->getEMailAddress(),
'oldEMailAddress' => $oldMailAddress,
diff --git a/settings/Mailer/NewUserMailHelper.php b/settings/Mailer/NewUserMailHelper.php
index c4c09653370..9fc6a4a3c70 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,18 @@ class NewUserMailHelper {
} else {
$link = $this->urlGenerator->getAbsoluteURL('/');
}
-
- $emailTemplate = $this->mailer->createEMailTemplate();
- $emailTemplate->addHeader();
$displayName = $user->getDisplayName();
$userId = $user->getUID();
+
+ $emailTemplate = $this->mailer->createEMailTemplate('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 +145,6 @@ class NewUserMailHelper {
);
$emailTemplate->addFooter();
- $emailTemplate->setMetaData('settings.Welcome', [
- 'link' => $link,
- 'displayname' => $displayName,
- 'userid' => $userId,
- 'instancename' => $this->themingDefaults->getName(),
- 'resetTokenGenerated' => $generatePasswordResetToken,
- ]);
-
return $emailTemplate;
}