Skip to content

Commit cf1a8d1

Browse files
authored
Merge pull request #2112 from nextcloud/addOptionDisableEmails
enh: Add link on emails to notifications settings
2 parents 0213be2 + b2483b2 commit cf1a8d1

3 files changed

Lines changed: 11 additions & 1 deletion

File tree

lib/DigestSender.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,11 @@ public function sendDigestForUser(IUser $user, int $now, string $timezone, strin
188188
);
189189
}
190190

191+
$template->addBodyText(
192+
$l10n->t('You can disable daily digest emails in the <a href="%s">settings</a>.', $this->urlGenerator->linkToRouteAbsolute('settings.PersonalSettings.index', ['section' => 'notifications'])),
193+
$l10n->t('You can disable daily digest emails in the settings: %s', $this->urlGenerator->linkToRouteAbsolute('settings.PersonalSettings.index', ['section' => 'notifications']))
194+
);
195+
191196
$template->addFooter('', $language);
192197

193198
$message = $this->mailer->createMessage();

lib/MailQueueHandler.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,11 @@ function ($event) use ($timezone, $l) {
341341
$template->addBodyListItem($l->n('and %n more ', 'and %n more ', $skippedCount));
342342
}
343343

344+
$template->addBodyText(
345+
$l->t('You can change the frequency of these emails or disable them in the <a href="%s">settings</a>.', $this->urlGenerator->linkToRouteAbsolute('settings.PersonalSettings.index', ['section' => 'notifications'])),
346+
$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']))
347+
);
348+
344349
$template->addFooter('', $lang);
345350

346351
$message = $this->mailer->createMessage();

tests/MailQueueHandlerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ public function testSendEmailToUser(): void {
284284
->method('addHeader');
285285
$template->expects($this->once())
286286
->method('addHeading');
287-
$template->expects($this->once())
287+
$template->expects($this->exactly(2))
288288
->method('addBodyText');
289289
$template->expects($this->once())
290290
->method('addFooter');

0 commit comments

Comments
 (0)