Skip to content

Commit

Permalink
Merge pull request #47476 from nextcloud/backport/47435/stable28
Browse files Browse the repository at this point in the history
[stable28] fix(mailer): Call to custom mail_template_class
  • Loading branch information
nickvergessen committed Aug 26, 2024
2 parents 344dda2 + da13234 commit 904345b
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions lib/private/Mail/Mailer.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,18 +130,6 @@ public function createAttachmentFromPath(string $path, $contentType = null): IAt
* @since 12.0.0
*/
public function createEMailTemplate(string $emailId, array $data = []): IEMailTemplate {
$class = $this->config->getSystemValueString('mail_template_class', '');

if ($class !== '' && class_exists($class) && is_a($class, EMailTemplate::class, true)) {
return new $class(
$this->defaults,
$this->urlGenerator,
$this->l10nFactory,
$emailId,
$data
);
}

$logoDimensions = $this->config->getAppValue('theming', 'logoDimensions', self::DEFAULT_DIMENSIONS);
if (str_contains($logoDimensions, 'x')) {
[$width, $height] = explode('x', $logoDimensions);
Expand All @@ -167,6 +155,20 @@ public function createEMailTemplate(string $emailId, array $data = []): IEMailTe
$logoWidth = $logoHeight = null;
}

$class = $this->config->getSystemValueString('mail_template_class', '');

if ($class !== '' && class_exists($class) && is_a($class, EMailTemplate::class, true)) {
return new $class(
$this->defaults,
$this->urlGenerator,
$this->l10nFactory,
$logoWidth,
$logoHeight,
$emailId,
$data
);
}

return new EMailTemplate(
$this->defaults,
$this->urlGenerator,
Expand Down

0 comments on commit 904345b

Please sign in to comment.