Skip to content

Commit

Permalink
feat: unsubscribe link to user profile (#8637)
Browse files Browse the repository at this point in the history
  • Loading branch information
kwasniew authored Nov 4, 2024
1 parent 08d0e45 commit 6f09bcd
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 10 deletions.
5 changes: 4 additions & 1 deletion src/lib/services/email-service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,11 @@ test('Can send productivity report email', async () => {
health: 99,
},
);
console.log(content);
expect(content.from).toBe('[email protected]');
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);
});
3 changes: 0 additions & 3 deletions src/lib/services/email-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -537,14 +537,11 @@ export class EmailService {
},
): Promise<IEmailEnvelope> {
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';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,7 @@
</div>
<div class="unsubscribe" style="font-size: 12px;color: #888;margin-top: 10px;">
This email was sent to {{userEmail}}. You’ve received this as you are a user of Unleash.<br>
{{#unsubscribeUrl}}
If you wish to unsubscribe, click <a href="{{unsubscribeUrl}}">here</a>.
{{/unsubscribeUrl}}
If you wish to unsubscribe, go to you profile settings <a href="{{unleashUrl}}/profile">here</a>.
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 <a href="{{unsubscribeUrl}}">here</a>.
{{/unsubscribeUrl}}
If you wish to unsubscribe, go to you profile settings <a href="{{unleashUrl}}/profile">here</a>.

0 comments on commit 6f09bcd

Please sign in to comment.