Skip to content

Commit edae79a

Browse files
committed
Unsubscribe link bug fix
1 parent 4c9a1fd commit edae79a

7 files changed

Lines changed: 12 additions & 11 deletions

File tree

RELEASE_NOTES.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
### 🐛 Bug Fixes
66

7-
- Unsubscribe link typo fixed
7+
- Unsubscribe link bug fixed.
88
- Various bug fixes and optimizations.
99

1010
### 📚 Docs

apps/backend/src/campaign/mutation.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ export const startCampaign = authProcedure
416416
"campaign.name": campaign.title,
417417
"campaign.subject": campaign.subject ?? "",
418418
"organization.name": organization.name,
419-
unsubscribe_url: `${generalSettings.baseURL}/unsubscribe?sid=${subscriber.id}&cid=${campaign.id}&mid=${messageId}`,
419+
unsubscribe_link: `${generalSettings.baseURL}/unsubscribe?sid=${subscriber.id}&cid=${campaign.id}&mid=${messageId}`,
420420
current_date: new Date().toLocaleDateString("en-CA"),
421421
}
422422

apps/backend/src/utils/placeholder-parser.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ describe("replacePlaceholders", () => {
4040
})
4141

4242
it("should handle placeholders with special characters in keys", () => {
43-
const template = "Link: {{unsubscribe_url}}"
44-
const data = { unsubscribe_url: "http://example.com/unsubscribe" }
43+
const template = "Link: {{unsubscribe_link}}"
44+
const data = { unsubscribe_link: "http://example.com/unsubscribe" }
4545
expect(replacePlaceholders(template, data)).toBe(
4646
"Link: http://example.com/unsubscribe"
4747
)
@@ -65,12 +65,12 @@ describe("replacePlaceholders", () => {
6565

6666
it("should correctly replace various types of placeholders", () => {
6767
const template =
68-
"Email: {{subscriber.email}}, Campaign: {{campaign.name}}, Org: {{organization.name}}, Unsub: {{unsubscribe_url}}, Date: {{current_date}}"
68+
"Email: {{subscriber.email}}, Campaign: {{campaign.name}}, Org: {{organization.name}}, Unsub: {{unsubscribe_link}}, Date: {{current_date}}"
6969
const data = {
7070
"subscriber.email": "test@example.com",
7171
"campaign.name": "Newsletter Q1",
7272
"organization.name": "MyCompany",
73-
unsubscribe_url: "domain.com/unsub",
73+
unsubscribe_link: "domain.com/unsub",
7474
current_date: "2024-01-01",
7575
}
7676
expect(replacePlaceholders(template, data)).toBe(

apps/backend/src/utils/placeholder-parser.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ export interface PlaceholderData {
1616
subscriber: SubscriberPlaceholderData
1717
campaign: CampaignPlaceholderData
1818
organization: OrganizationPlaceholderData
19-
unsubscribe_url: string
19+
unsubscribe_link: string
2020
current_date?: string
2121
}
2222

2323
export type PlaceholderDataKey =
2424
| `subscriber.${keyof SubscriberPlaceholderData}`
2525
| `campaign.${keyof CampaignPlaceholderData}`
2626
| `organization.${keyof OrganizationPlaceholderData}`
27-
| `unsubscribe_url`
27+
| `unsubscribe_link`
2828
| `current_date`
2929
| `subscriber.metadata.${string}`
3030

apps/docs/src/app/getting-started/page.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ We've made LetterSpace for simplicity and ease of use. The easiest way to get st
3030

3131
backend:
3232
image: ghcr.io/dcodesdev/letterspace:0.4
33+
pull_policy: always
3334
restart: always
3435
depends_on:
3536
- db

apps/docs/src/app/placeholders/page.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Placeholders are special tags you can insert into your emails. When you send an
99
| `{{campaign.name}}` | The name/title of the campaign. | `Q3 Newsletter` |
1010
| `{{campaign.subject}}` | The subject line of the campaign. | `Your Weekly Update!` |
1111
| `{{organization.name}}` | The name of the organization sending the campaign. | `MyCompany Inc.` |
12-
| `{{unsubscribe_url}}` | The unique URL for a subscriber to unsubscribe from communications. | `https://example.com/unsubscribe?sid=subscriberId&cid=campaignId` |
12+
| `{{unsubscribe_link}}` | The unique URL for a subscriber to unsubscribe from communications. | `https://example.com/unsubscribe?sid=subscriberId&cid=campaignId` |
1313
| `{{current_date}}` | The current date. The format can vary (e.g., "YYYY-MM-DD"). | `2023-10-27` |
1414
| `{{subscriber.metadata.some_key}}` | A custom metadata field for the subscriber. Replace `some_key` with your actual metadata key. | `custom_value` |
1515

@@ -54,7 +54,7 @@ Here are the placeholders you can use in your emails:
5454

5555
### Utility Placeholders
5656

57-
- `{{unsubscribe_url}}`: The unique URL for a subscriber to unsubscribe from communications. This is important for allowing your subscribers to manage their preferences.
57+
- `{{unsubscribe_link}}`: The unique URL for a subscriber to unsubscribe from communications. This is important for allowing your subscribers to manage their preferences.
5858
- Example: `https://example.com/unsubscribe?sid=subscriberId&cid=campaignId`
5959
- `{{current_date}}`: The current date when the email is sent. You can use this to include timely information. The format will typically be "YYYY-MM-DD".
6060
- Example: `2023-10-27`

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "0.4.2",
2+
"version": "0.4.4",
33
"name": "letterspace",
44
"private": true,
55
"scripts": {

0 commit comments

Comments
 (0)