Skip to content

Commit 920ad31

Browse files
committed
fix(coderd/notifications): fix oversights in template migration
1 parent d6a339f commit 920ad31

7 files changed

+14
-12
lines changed

coderd/database/migrations/000262_improve_notification_templates.up.sql

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ WHERE
6161
-- TemplateDeleted
6262
UPDATE notification_templates
6363
SET
64-
body_template = E'Hi {{.UserName}}i,\n\n' || -- Add a comma
64+
body_template = E'Hi {{.UserName}},\n\n' || -- Add a comma
6565
E'The template **{{.Labels.name}}** was deleted by **{{ .Labels.initiator }}**.\n\n' ||
6666
-- Mention template display name:
6767
E'The template''s display name was **{{.Labels.display_name}}**.'
@@ -100,7 +100,7 @@ WHERE
100100
-- WorkspaceDormant
101101
UPDATE notification_templates
102102
SET
103-
body_template = E'Hi {{.UserName}}\n\n,' || -- add comma
103+
body_template = E'Hi {{.UserName}},\n\n' || -- add comma
104104
E'Your workspace **{{.Labels.name}}** has been marked as [**dormant**](https://coder.com/docs/templates/schedule#dormancy-threshold-enterprise) because of {{.Labels.reason}}.\n' ||
105105
E'Dormant workspaces are [automatically deleted](https://coder.com/docs/templates/schedule#dormancy-auto-deletion-enterprise) after {{.Labels.timeTilDormant}} of inactivity.\n' ||
106106
E'To prevent deletion, use your workspace with the link below.'
@@ -110,7 +110,7 @@ WHERE
110110
-- WorkspaceMarkedForDeletion
111111
UPDATE notification_templates
112112
SET
113-
body_template = E'Hi {{.UserName}}\n\n,' || -- add comma
113+
body_template = E'Hi {{.UserName}},\n\n' || -- add comma
114114
E'Your workspace **{{.Labels.name}}** has been marked for **deletion** after {{.Labels.timeTilDormant}} of [dormancy](https://coder.com/docs/templates/schedule#dormancy-auto-deletion-enterprise) because of {{.Labels.reason}}.\n' ||
115115
E'To prevent deletion, use your workspace with the link below.'
116116
WHERE
@@ -122,7 +122,7 @@ SET
122122
body_template = E'Hi {{.UserName}},\n\n' ||
123123
E'A manual build of the workspace **{{.Labels.name}}** using the template **{{.Labels.template_name}}** failed (version: **{{.Labels.template_version_name}}**).\n\n' ||
124124
-- Mention template display name:
125-
E'The template''s display name was **{{.Labels.template_display_name}}**.' ||
125+
E'The template''s display name was **{{.Labels.template_display_name}}**. ' ||
126126
E'The workspace build was initiated by **{{.Labels.initiator}}**.'
127127
WHERE
128128
id = '2faeee0f-26cb-4e96-821c-85ccb9f71513';

coderd/notifications/notifications_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -764,7 +764,9 @@ func TestNotificationTemplates_Golden(t *testing.T) {
764764
payload: types.MessagePayload{
765765
UserName: "Bobby",
766766
Labels: map[string]string{
767-
"created_account_name": "bobby",
767+
"created_account_name": "bobby",
768+
"created_account_user_name": "William Tables",
769+
"account_creator": "rob",
768770
},
769771
},
770772
},

coderd/notifications/testdata/rendered-templates/TemplateTemplateDeleted-body.md.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Hi Bobbyi,
1+
Hi Bobby,
22

33
The template **bobby-template** was deleted by **rob**.
44

coderd/notifications/testdata/rendered-templates/TemplateUserAccountCreated-body.md.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ Hi Bobby,
22

33
New user account **bobby** has been created.
44

5-
This new user account was created for **<no value>** by **<no value>**
5+
This new user account was created for **William Tables** by **rob**
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
Hi Bobby
1+
Hi Bobby,
22

3-
,Your workspace **bobby-workspace** has been marked as [**dormant**](https://coder.com/docs/templates/schedule#dormancy-threshold-enterprise) because of breached the template's threshold for inactivity.
3+
Your workspace **bobby-workspace** has been marked as [**dormant**](https://coder.com/docs/templates/schedule#dormancy-threshold-enterprise) because of breached the template's threshold for inactivity.
44
Dormant workspaces are [automatically deleted](https://coder.com/docs/templates/schedule#dormancy-auto-deletion-enterprise) after 24 hours of inactivity.
55
To prevent deletion, use your workspace with the link below.

coderd/notifications/testdata/rendered-templates/TemplateWorkspaceManualBuildFailed-body.md.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ Hi Bobby,
22

33
A manual build of the workspace **bobby-workspace** using the template **bobby-template** failed (version: **bobby-template-version**).
44

5-
The template's display name was **William's Template**.The workspace build was initiated by **joe**.
5+
The template's display name was **William's Template**. The workspace build was initiated by **joe**.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Hi Bobby
1+
Hi Bobby,
22

3-
,Your workspace **bobby-workspace** has been marked for **deletion** after 24 hours of [dormancy](https://coder.com/docs/templates/schedule#dormancy-auto-deletion-enterprise) because of template updated to new dormancy policy.
3+
Your workspace **bobby-workspace** has been marked for **deletion** after 24 hours of [dormancy](https://coder.com/docs/templates/schedule#dormancy-auto-deletion-enterprise) because of template updated to new dormancy policy.
44
To prevent deletion, use your workspace with the link below.

0 commit comments

Comments
 (0)