Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: unsubscribe link to user profile #8637

Merged
merged 2 commits into from
Nov 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We will probably need to also put unsubscripe url in headers. We need it on this level

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But it will be different from the profile link that I used and composed in the template. I will add a task for the header in issue tracking


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>.
Loading