diff --git a/coderd/database/migrations/000264_manual_build_failed_notification_template.down.sql b/coderd/database/migrations/000264_manual_build_failed_notification_template.down.sql new file mode 100644 index 0000000000000..9a9d5b9c5c002 --- /dev/null +++ b/coderd/database/migrations/000264_manual_build_failed_notification_template.down.sql @@ -0,0 +1,18 @@ +UPDATE notification_templates +SET + body_template = E'Hi {{.UserName}},\n\n' || + E'A manual build of the workspace **{{.Labels.name}}** using the template **{{.Labels.template_name}}** failed (version: **{{.Labels.template_version_name}}**).\n\n' || + -- Mention template display name: + E'The template''s display name was **{{.Labels.template_display_name}}**. ' || + E'The workspace build was initiated by **{{.Labels.initiator}}**.' +WHERE + id = '2faeee0f-26cb-4e96-821c-85ccb9f71513'; + +UPDATE notification_templates +SET + body_template = E'Hi {{.UserName}},\n\n' || -- Add a comma + E'The template **{{.Labels.name}}** was deleted by **{{ .Labels.initiator }}**.\n\n' || + -- Mention template display name: + E'The template''s display name was **{{.Labels.display_name}}**.' +WHERE + id = '29a09665-2a4c-403f-9648-54301670e7be'; diff --git a/coderd/database/migrations/000264_manual_build_failed_notification_template.up.sql b/coderd/database/migrations/000264_manual_build_failed_notification_template.up.sql new file mode 100644 index 0000000000000..b5deebe30369f --- /dev/null +++ b/coderd/database/migrations/000264_manual_build_failed_notification_template.up.sql @@ -0,0 +1,16 @@ +UPDATE notification_templates +SET + body_template = E'Hi {{.UserName}},\n\n' || + -- Revert to a single label for the template name: + E'A manual build of the workspace **{{.Labels.name}}** using the template **{{.Labels.template_name}}** failed (version: **{{.Labels.template_version_name}}**).\n\n' || + E'The workspace build was initiated by **{{.Labels.initiator}}**.' +WHERE + id = '2faeee0f-26cb-4e96-821c-85ccb9f71513'; + +UPDATE notification_templates +SET + body_template = E'Hi {{.UserName}},\n\n' || + -- Revert to a single label for the template name: + E'The template **{{.Labels.name}}** was deleted by **{{ .Labels.initiator }}**.\n\n' +WHERE + id = '29a09665-2a4c-403f-9648-54301670e7be'; diff --git a/coderd/notifications/notifications_test.go b/coderd/notifications/notifications_test.go index d6eb480f75c9b..61862826acca1 100644 --- a/coderd/notifications/notifications_test.go +++ b/coderd/notifications/notifications_test.go @@ -870,9 +870,8 @@ func TestNotificationTemplates_Golden(t *testing.T) { UserEmail: "bobby@coder.com", UserUsername: "bobby", Labels: map[string]string{ - "name": "bobby-template", - "display_name": "Bobby's Template", - "initiator": "rob", + "name": "Bobby's Template", + "initiator": "rob", }, }, }, @@ -886,7 +885,6 @@ func TestNotificationTemplates_Golden(t *testing.T) { Labels: map[string]string{ "name": "bobby-workspace", "template_name": "bobby-template", - "template_display_name": "William's Template", "template_version_name": "bobby-template-version", "initiator": "joe", "workspace_owner_username": "mrbobby", diff --git a/coderd/notifications/testdata/rendered-templates/smtp/TemplateTemplateDeleted.html.golden b/coderd/notifications/testdata/rendered-templates/smtp/TemplateTemplateDeleted.html.golden index ec7c3cfdce485..2ae9ac8e61db5 100644 --- a/coderd/notifications/testdata/rendered-templates/smtp/TemplateTemplateDeleted.html.golden +++ b/coderd/notifications/testdata/rendered-templates/smtp/TemplateTemplateDeleted.html.golden @@ -1,6 +1,6 @@ From: system@coder.com To: bobby@coder.com -Subject: Template "bobby-template" deleted +Subject: Template "Bobby's Template" deleted Message-Id: 02ee4935-73be-4fa1-a290-ff9999026b13@blush-whale-48 Date: Fri, 11 Oct 2024 09:03:06 +0000 Content-Type: multipart/alternative; boundary=bbe61b741255b6098bb6b3c1f41b885773df633cb18d2a3002b68e4bc9c4 @@ -12,9 +12,7 @@ Content-Type: text/plain; charset=UTF-8 Hi Bobby, -The template bobby-template was deleted by rob. - -The template's display name was Bobby's Template. +The template Bobby's Template was deleted by rob. View templates: http://test.com/templates @@ -29,7 +27,7 @@ Content-Type: text/html; charset=UTF-8 -