mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
fix(coderd/notifications): simplify TemplateWorkspaceManualBuildFailed (#15067)
This PR closes #15065. As advised by @mtojek, a template's display name may be set to "", which is not useful in an email notification. We'd like to provide a friendly name for the template, but it also needs to be identifiable. As such, we fall back to template.Name in the case that the template's display name is empty.
This commit is contained in:
@@ -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';
|
||||
@@ -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';
|
||||
Reference in New Issue
Block a user