mirror of
https://github.com/friendica/friendica
synced 2025-04-26 21:50:11 +00:00
Extract System emails from enotify
- Removed every SYSTEM_EMAIL occurrence in enotify - Introduced a "SystemMailBuilder" for build system emails - Replaced every SYSTEM_EMAIL usage in the classes with calling this builder - Added tests for this new Builder - Split the email templates between "base" template for email and concrete usages for different use cases
This commit is contained in:
parent
74490d6594
commit
3291728059
18 changed files with 647 additions and 118 deletions
|
@ -64,17 +64,14 @@ function lostpass_post(App $a)
|
|||
Site Location: %2$s
|
||||
Login Name: %3$s', $resetlink, DI::baseUrl(), $user['nickname']));
|
||||
|
||||
notification([
|
||||
'type' => SYSTEM_EMAIL,
|
||||
'language' => $user['language'],
|
||||
'to_name' => $user['username'],
|
||||
'to_email' => $user['email'],
|
||||
'uid' => $user['uid'],
|
||||
'subject' => DI::l10n()->t('Password reset requested at %s', $sitename),
|
||||
'preamble' => $preamble,
|
||||
'body' => $body
|
||||
]);
|
||||
$email = DI::emailer()
|
||||
->newSystemMail((!empty($user['language'])) ? DI::l10n()->withLang($user['language']) : DI::l10n())
|
||||
->withMessage(DI::l10n()->t('Password reset requested at %s', $sitename), $preamble, $body)
|
||||
->forUser($user['uid'] ?? 0)
|
||||
->withRecipient($user['to_email'])
|
||||
->build();
|
||||
|
||||
DI::emailer()->send($email);
|
||||
DI::baseUrl()->redirect();
|
||||
}
|
||||
|
||||
|
@ -159,16 +156,13 @@ function lostpass_generate_password($user)
|
|||
You may change that password from your account settings page after logging in.
|
||||
', DI::baseUrl(), $user['nickname'], $new_password));
|
||||
|
||||
notification([
|
||||
'type' => SYSTEM_EMAIL,
|
||||
'language' => $user['language'],
|
||||
'to_name' => $user['username'],
|
||||
'to_email' => $user['email'],
|
||||
'uid' => $user['uid'],
|
||||
'subject' => DI::l10n()->t('Your password has been changed at %s', $sitename),
|
||||
'preamble' => $preamble,
|
||||
'body' => $body
|
||||
]);
|
||||
$email = DI::emailer()
|
||||
->newSystemMail((!empty($user['language'])) ? DI::l10n()->withLang($user['language']) : DI::l10n())
|
||||
->withMessage(DI::l10n()->t('Your password has been changed at %s', $sitename), $preamble, $body)
|
||||
->forUser($user['uid'] ?? 0)
|
||||
->withRecipient($user['to_email'])
|
||||
->build();
|
||||
DI::emailer()->send($email);
|
||||
}
|
||||
|
||||
return $o;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue