From b37571affb518d6368a3ca10b81f59055ea78977 Mon Sep 17 00:00:00 2001 From: kwasniew Date: Mon, 4 Nov 2024 11:36:05 +0100 Subject: [PATCH 1/2] feat: unsubscribe link to user profile --- 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 a8a914a37eb0..513ac569045c 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/insights`)).toBe(true); }); diff --git a/src/lib/services/email-service.ts b/src/lib/services/email-service.ts index 155c7d187c94..e7e6bcacb543 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 8bfaece45857..59e93a7f3e82 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 6f7ccc1f3cd7..4c23236ce4b3 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. From bf2b72b61764ee6dd36c20bbbbf8bc24053c7c0a Mon Sep 17 00:00:00 2001 From: Mateusz Kwasniewski Date: Mon, 4 Nov 2024 11:58:00 +0100 Subject: [PATCH 2/2] Update src/lib/services/email-service.test.ts Co-authored-by: Tymoteusz Czech <2625371+Tymek@users.noreply.github.com> --- src/lib/services/email-service.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/services/email-service.test.ts b/src/lib/services/email-service.test.ts index 513ac569045c..a25a6ce7e0df 100644 --- a/src/lib/services/email-service.test.ts +++ b/src/lib/services/email-service.test.ts @@ -175,5 +175,5 @@ test('Can send productivity report email', async () => { 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/insights`)).toBe(true); + expect(content.text.includes(`localhost/profile`)).toBe(true); });