mirror of
https://github.com/friendica/friendica
synced 2025-04-26 16:30:12 +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
|
@ -897,13 +897,13 @@ class User
|
|||
$password
|
||||
));
|
||||
|
||||
return notification([
|
||||
'type' => SYSTEM_EMAIL,
|
||||
'uid' => $user['uid'],
|
||||
'to_email' => $user['email'],
|
||||
'subject' => DI::l10n()->t('Registration at %s', $sitename),
|
||||
'body' => $body
|
||||
]);
|
||||
$email = DI::emailer()
|
||||
->newSystemMail(DI::l10n())
|
||||
->withMessage(DI::l10n()->t('Registration at %s', $sitename), $body)
|
||||
->forUser($user['uid'] ?? 0)
|
||||
->withRecipient($user['email'])
|
||||
->build();
|
||||
return DI::emailer()->send($email);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -965,15 +965,13 @@ class User
|
|||
$password
|
||||
));
|
||||
|
||||
return notification([
|
||||
'uid' => $user['uid'],
|
||||
'language' => $user['language'],
|
||||
'type' => SYSTEM_EMAIL,
|
||||
'to_email' => $user['email'],
|
||||
'subject' => DI::l10n()->t('Registration details for %s', $sitename),
|
||||
'preamble' => $preamble,
|
||||
'body' => $body
|
||||
]);
|
||||
$email = DI::emailer()
|
||||
->newSystemMail((!empty($user['language'])) ? DI::l10n()->withLang($user['language']) : DI::l10n())
|
||||
->withMessage(DI::l10n()->t('Registration details for %s', $sitename), $preamble, $body)
|
||||
->forUser($user['uid'] ?? 0)
|
||||
->withRecipient($user['email'])
|
||||
->build();
|
||||
return DI::emailer()->send($email);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue