Skip to content

Commit 406e973

Browse files
fix(emails): Update unsubscribe link (#424)
* Update link * Upd * Fix tests
1 parent 0604037 commit 406e973

4 files changed

Lines changed: 10 additions & 1 deletion

File tree

workers/email/src/templates/emails/event/html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
{% endblock %}
5959

6060
{% block unsubscribeLink %}
61-
{{ host ~ '/unsubscribe/' ~ project._id }}
61+
{{ host ~ '/unsubscribe/' ~ project._id ~ '/' ~ notificationRuleId }}
6262
{% endblock %}
6363

6464
{% block unsubscribeText %}

workers/email/tests/provider.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ describe('EmailProvider', () => {
8181
period: 60,
8282
host: process.env.GARAGE_URL!,
8383
hostOfStatic: process.env.API_STATIC_URL!,
84+
notificationRuleId: '5d206f7f9aaf7c0071d64596',
8485
project: {
8586
_id: new ObjectId('5d206f7f9aaf7c0071d64596'),
8687
token: 'project-token',
@@ -131,6 +132,7 @@ describe('EmailProvider', () => {
131132
}],
132133
host: process.env.GARAGE_URL!,
133134
hostOfStatic: process.env.API_STATIC_URL!,
135+
notificationRuleId: '5d206f7f9aaf7c0071d64596',
134136
project: {
135137
_id: new ObjectId('5d206f7f9aaf7c0071d64596'),
136138
token: 'project-token',

workers/sender/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ export default abstract class SenderWorker extends Worker {
196196
project,
197197
events: eventsData,
198198
period: channel.minPeriod,
199+
notificationRuleId: rule._id,
199200
},
200201
} as EventNotification | SeveralEventsNotification);
201202
}

workers/sender/types/template-variables/event.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,12 @@ export interface EventsTemplateVariables extends CommonTemplateVariables {
4545
* Minimal pause between second notification, in seconds
4646
*/
4747
period: number;
48+
49+
/**
50+
* Id of notification rule to unsubscribe.
51+
* Required for email notifications – to form unsubscribe link.
52+
*/
53+
notificationRuleId?: string;
4854
}
4955

5056
/**

0 commit comments

Comments
 (0)