From b2483b2e1250735dcc59024f6aa6776eccb0d485 Mon Sep 17 00:00:00 2001 From: Git'Fellow <12234510+solracsf@users.noreply.github.com> Date: Sun, 31 Aug 2025 10:48:06 +0200 Subject: [PATCH] feat(email): Add link to settings Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com> --- lib/DigestSender.php | 5 +++++ lib/MailQueueHandler.php | 5 +++++ tests/MailQueueHandlerTest.php | 2 +- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/DigestSender.php b/lib/DigestSender.php index f79eb3af7..c04be50b5 100644 --- a/lib/DigestSender.php +++ b/lib/DigestSender.php @@ -188,6 +188,11 @@ public function sendDigestForUser(IUser $user, int $now, string $timezone, strin ); } + $template->addBodyText( + $l10n->t('You can disable daily digest emails in the settings.', $this->urlGenerator->linkToRouteAbsolute('settings.PersonalSettings.index', ['section' => 'notifications'])), + $l10n->t('You can disable daily digest emails in the settings: %s', $this->urlGenerator->linkToRouteAbsolute('settings.PersonalSettings.index', ['section' => 'notifications'])) + ); + $template->addFooter('', $language); $message = $this->mailer->createMessage(); diff --git a/lib/MailQueueHandler.php b/lib/MailQueueHandler.php index 5de9fd27f..4320329db 100644 --- a/lib/MailQueueHandler.php +++ b/lib/MailQueueHandler.php @@ -341,6 +341,11 @@ function ($event) use ($timezone, $l) { $template->addBodyListItem($l->n('and %n more ', 'and %n more ', $skippedCount)); } + $template->addBodyText( + $l->t('You can change the frequency of these emails or disable them in the settings.', $this->urlGenerator->linkToRouteAbsolute('settings.PersonalSettings.index', ['section' => 'notifications'])), + $l->t('You can change the frequency of these emails or disable them in the settings: %s', $this->urlGenerator->linkToRouteAbsolute('settings.PersonalSettings.index', ['section' => 'notifications'])) + ); + $template->addFooter('', $lang); $message = $this->mailer->createMessage(); diff --git a/tests/MailQueueHandlerTest.php b/tests/MailQueueHandlerTest.php index 17c5c6d13..e8e06dc31 100644 --- a/tests/MailQueueHandlerTest.php +++ b/tests/MailQueueHandlerTest.php @@ -284,7 +284,7 @@ public function testSendEmailToUser(): void { ->method('addHeader'); $template->expects($this->once()) ->method('addHeading'); - $template->expects($this->once()) + $template->expects($this->exactly(2)) ->method('addBodyText'); $template->expects($this->once()) ->method('addFooter');