From c7793a6017d82028f61614f7fbd73b3feaa37863 Mon Sep 17 00:00:00 2001 From: Luffy Date: Mon, 28 Sep 2026 17:40:45 +0800 Subject: [PATCH] fix(email): link notification preferences to settings tab MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Make the “Manage preferences” text in notification emails clickable. - Link directly to `/settings?tab=notifications`. - Preserve the localized link text and existing email styling. - Add a regression test for the generated preferences URL. --- server/src/nest/notifications/mailer/email-html.ts | 3 ++- server/tests/unit/nest/notification-transports.test.ts | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/server/src/nest/notifications/mailer/email-html.ts b/server/src/nest/notifications/mailer/email-html.ts index 8bef780a7..6cf27d974 100644 --- a/server/src/nest/notifications/mailer/email-html.ts +++ b/server/src/nest/notifications/mailer/email-html.ts @@ -41,6 +41,7 @@ export function buildEmailHtml( const s = I18N[lang] || I18N.en; const appUrl = getAppUrl(); const ctaHref = escapeHtml(navigateTarget ? `${appUrl}${navigateTarget}` : appUrl || ''); + const manageHref = escapeHtml(`${appUrl}/settings?tab=notifications`); const safeSubject = escapeHtml(subject); const safeBody = rawBody ? body : escapeHtml(body); @@ -73,7 +74,7 @@ export function buildEmailHtml( } -

${s.footer}
${s.manage}

+

${s.footer}
${s.manage}

${s.madeWith} ♥ by Maurice · GitHub

diff --git a/server/tests/unit/nest/notification-transports.test.ts b/server/tests/unit/nest/notification-transports.test.ts index d799a9c92..111c9ce0a 100644 --- a/server/tests/unit/nest/notification-transports.test.ts +++ b/server/tests/unit/nest/notification-transports.test.ts @@ -221,6 +221,13 @@ describe('buildEmailHtml', () => { expect(html).toContain('notifications enabled in TREK'); }); + it('links notification preferences to the notifications settings tab', () => { + const html = buildEmailHtml('Subject', 'Body', 'en'); + expect(html).toMatch( + /]*>Manage preferences in Settings<\/a>/, + ); + }); + it('uses German i18n strings for lang=de', () => { const html = buildEmailHtml('Subject', 'Body', 'de'); expect(html).toContain('TREK aktiviert');