Move "App::getSenderEmailAddress()" to "Emailer::getSiteEmailAddress()"

This commit is contained in:
nupplaPhil 2020-02-01 23:32:03 +01:00
parent 206b53477e
commit 0e13428210
No known key found for this signature in database
GPG key ID: D8365C3D36B77D90
5 changed files with 45 additions and 41 deletions

View file

@ -26,19 +26,18 @@ class SystemMailBuilder extends MailBuilder
/** @var string */
protected $siteAdmin;
public function __construct(App $a, L10n $l10n, BaseURL $baseUrl, IConfig $config)
public function __construct(L10n $l10n, BaseURL $baseUrl, IConfig $config, string $siteEmailAddress, string $siteName)
{
parent::__construct($l10n, $baseUrl, $config);
$siteName = $this->config->get('config', 'sitename');
if ($this->config->get('config', 'admin_name')) {
$this->siteAdmin = $l10n->t('%1$s, %2$s Administrator', $this->config->get('config', 'admin_name'), $siteName);
} else {
$this->siteAdmin = $l10n->t('%s Administrator', $siteName);
}
$this->senderAddress = $a->getSenderEmailAddress();
// Set the system wide site address/name as sender (default for system mails)
$this->withSender($siteEmailAddress, $siteName);
}
/**
@ -109,15 +108,4 @@ class SystemMailBuilder extends MailBuilder
'$textversion' => $textVersion,
]);
}
/**
* {@inheritDoc}
*/
public function build(bool $raw = false)
{
// for system emails, always use the sitename/site address as the sender
$this->withSender($this->config->get('config', 'sitename'), $this->senderAddress);
return parent::build($raw);
}
}