From 6f09bcdee1e69f85a9486c23bd5917f3449be8cb Mon Sep 17 00:00:00 2001 From: Mateusz Kwasniewski Date: Mon, 4 Nov 2024 12:10:32 +0100 Subject: [PATCH] feat: unsubscribe link to user profile (#8637) --- src/lib/services/email-service.test.ts | 5 ++++- src/lib/services/email-service.ts | 3 --- .../productivity-report/productivity-report.html.mustache | 4 +--- .../productivity-report/productivity-report.plain.mustache | 4 +--- 4 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/lib/services/email-service.test.ts b/src/lib/services/email-service.test.ts index a8a914a37e..a25a6ce7e0 100644 --- a/src/lib/services/email-service.test.ts +++ b/src/lib/services/email-service.test.ts @@ -169,8 +169,11 @@ test('Can send productivity report email', async () => { health: 99, }, ); - console.log(content); expect(content.from).toBe('noreply@getunleash.ai'); expect(content.subject).toBe('Unleash - productivity report'); expect(content.html.includes(`Productivity Report`)).toBe(true); + expect(content.html.includes(`localhost/insights`)).toBe(true); + expect(content.html.includes(`localhost/profile`)).toBe(true); + expect(content.text.includes(`localhost/insights`)).toBe(true); + expect(content.text.includes(`localhost/profile`)).toBe(true); }); diff --git a/src/lib/services/email-service.ts b/src/lib/services/email-service.ts index 155c7d187c..e7e6bcacb5 100644 --- a/src/lib/services/email-service.ts +++ b/src/lib/services/email-service.ts @@ -537,14 +537,11 @@ export class EmailService { }, ): Promise { if (this.configured()) { - const unsubscribeUrl = '{{amazonSESUnsubscribeUrl}}'; // FIXME: Add unsubscribe URL - const context = { userName, userEmail, ...metrics, unleashUrl: this.config.server.unleashUrl, - unsubscribeUrl, }; const template = 'productivity-report'; diff --git a/src/mailtemplates/productivity-report/productivity-report.html.mustache b/src/mailtemplates/productivity-report/productivity-report.html.mustache index 8bfaece458..59e93a7f3e 100644 --- a/src/mailtemplates/productivity-report/productivity-report.html.mustache +++ b/src/mailtemplates/productivity-report/productivity-report.html.mustache @@ -72,9 +72,7 @@
This email was sent to {{userEmail}}. You’ve received this as you are a user of Unleash.
- {{#unsubscribeUrl}} - If you wish to unsubscribe, click here. - {{/unsubscribeUrl}} + If you wish to unsubscribe, go to you profile settings here.
diff --git a/src/mailtemplates/productivity-report/productivity-report.plain.mustache b/src/mailtemplates/productivity-report/productivity-report.plain.mustache index 6f7ccc1f3c..4c23236ce4 100644 --- a/src/mailtemplates/productivity-report/productivity-report.plain.mustache +++ b/src/mailtemplates/productivity-report/productivity-report.plain.mustache @@ -14,6 +14,4 @@ Production updates last month: {{productionUpdates}} Go to your Insights to learn more: {{unleashUrl}}/insights This email was sent to {{userEmail}}. You’ve received this as you are a user of Unleash. -{{#unsubscribeUrl}} - If you wish to unsubscribe, click here. -{{/unsubscribeUrl}} +If you wish to unsubscribe, go to you profile settings here.