Skip to content

armgit / TREK

Public Imported from GitHub
0

The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.

fix(email): link notification preferences to settings tab

Luffyc7793a6017d8
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(
}
<!-- Footer -->
<tr><td style="padding: 20px 32px; background: #f9fafb; border-top: 1px solid #f3f4f6; text-align: center;">
- <p style="margin: 0 0 8px; font-size: 11px; color: #9ca3af; line-height: 1.5;">${s.footer}<br>${s.manage}</p>
+ <p style="margin: 0 0 8px; font-size: 11px; color: #9ca3af; line-height: 1.5;">${s.footer}<br><a href="${manageHref}" style="color: #9ca3af; text-decoration: underline;">${s.manage}</a></p>
<p style="margin: 0; font-size: 10px; color: #d1d5db;">${s.madeWith} <span style="color: #ef4444;">&hearts;</span> by Maurice &middot; <a href="https://github.com/liketrek/TREK" style="color: #9ca3af; text-decoration: none;">GitHub</a></p>
</td></tr>
</table>
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(
+ /<a href="https?:\/\/[^"]+\/settings\?tab=notifications"[^>]*>Manage preferences in Settings<\/a>/,
+ );
+ });
+
it('uses German i18n strings for lang=de', () => {
const html = buildEmailHtml('Subject', 'Body', 'de');
expect(html).toContain('TREK aktiviert');