From ddb06741c91fcfed348a9babe519a6c7de2633ec Mon Sep 17 00:00:00 2001
From: Vincent Vielle
Date: Wed, 26 Mar 2025 15:54:03 +0100
Subject: [PATCH] chore: improve dormant workspace notification wording
(#17100)
Related to #17099
---
...ve_dormant_workspace_notification.down.sql | 3 +++
...rove_dormant_workspace_notification.up.sql | 3 +++
.../smtp/TemplateWorkspaceDormant.html.golden | 26 ++++++++++---------
.../TemplateWorkspaceDormant.json.golden | 4 +--
4 files changed, 22 insertions(+), 14 deletions(-)
create mode 100644 coderd/database/migrations/000311_improve_dormant_workspace_notification.down.sql
create mode 100644 coderd/database/migrations/000311_improve_dormant_workspace_notification.up.sql
diff --git a/coderd/database/migrations/000311_improve_dormant_workspace_notification.down.sql b/coderd/database/migrations/000311_improve_dormant_workspace_notification.down.sql
new file mode 100644
index 0000000000..1414f4dfa4
--- /dev/null
+++ b/coderd/database/migrations/000311_improve_dormant_workspace_notification.down.sql
@@ -0,0 +1,3 @@
+UPDATE notification_templates SET body_template = E'Your workspace **{{.Labels.name}}** has been marked as [**dormant**](https://coder.com/docs/templates/schedule#dormancy-threshold-enterprise) because of {{.Labels.reason}}.\n' ||
+ E'Dormant workspaces are [automatically deleted](https://coder.com/docs/templates/schedule#dormancy-auto-deletion-enterprise) after {{.Labels.timeTilDormant}} of inactivity.\n' ||
+ E'To prevent deletion, use your workspace with the link below.' WHERE id = '0ea69165-ec14-4314-91f1-69566ac3c5a0';
diff --git a/coderd/database/migrations/000311_improve_dormant_workspace_notification.up.sql b/coderd/database/migrations/000311_improve_dormant_workspace_notification.up.sql
new file mode 100644
index 0000000000..146ef365da
--- /dev/null
+++ b/coderd/database/migrations/000311_improve_dormant_workspace_notification.up.sql
@@ -0,0 +1,3 @@
+UPDATE notification_templates SET body_template = E'Your workspace **{{.Labels.name}}** has been marked as [**dormant**](https://coder.com/docs/templates/schedule#dormancy-threshold-enterprise) due to inactivity exceeding the dormancy threshold.\n\n' ||
+ E'This workspace will be automatically deleted in {{.Labels.timeTilDormant}} if it remains inactive.\n\n' ||
+ E'To prevent deletion, activate your workspace using the link below.' WHERE id = '0ea69165-ec14-4314-91f1-69566ac3c5a0';
diff --git a/coderd/notifications/testdata/rendered-templates/smtp/TemplateWorkspaceDormant.html.golden b/coderd/notifications/testdata/rendered-templates/smtp/TemplateWorkspaceDormant.html.golden
index 40bd6fc135..ee3021c18c 100644
--- a/coderd/notifications/testdata/rendered-templates/smtp/TemplateWorkspaceDormant.html.golden
+++ b/coderd/notifications/testdata/rendered-templates/smtp/TemplateWorkspaceDormant.html.golden
@@ -13,12 +13,13 @@ Content-Type: text/plain; charset=UTF-8
Hi Bobby,
Your workspace bobby-workspace has been marked as dormant (https://coder.co=
-m/docs/templates/schedule#dormancy-threshold-enterprise) because of breache=
-d the template's threshold for inactivity.
-Dormant workspaces are automatically deleted (https://coder.com/docs/templa=
-tes/schedule#dormancy-auto-deletion-enterprise) after 24 hours of inactivit=
-y.
-To prevent deletion, use your workspace with the link below.
+m/docs/templates/schedule#dormancy-threshold-enterprise) due to inactivity =
+exceeding the dormancy threshold.
+
+This workspace will be automatically deleted in 24 hours if it remains inac=
+tive.
+
+To prevent deletion, activate your workspace using the link below.
View workspace: http://test.com/@bobby/bobby-workspace
@@ -54,12 +55,13 @@ argin: 8px 0 32px; line-height: 1.5;">
Hi Bobby,
Your workspace bobby-workspace has been marked =
as dormant because of breached the template&r=
-squo;s threshold for inactivity.
-Dormant workspaces are automatically deleted after 24 hour=
-s of inactivity.
-To prevent deletion, use your workspace with the link below.
+enterprise">dormant due to inactivity exceeding the do=
+rmancy threshold.
+
+This workspace will be automatically deleted in 24 hours if it remains i=
+nactive.
+
+To prevent deletion, activate your workspace using the link below.
=20
diff --git a/coderd/notifications/testdata/rendered-templates/webhook/TemplateWorkspaceDormant.json.golden b/coderd/notifications/testdata/rendered-templates/webhook/TemplateWorkspaceDormant.json.golden
index 5cfc61dea2..2d85eb6e6b 100644
--- a/coderd/notifications/testdata/rendered-templates/webhook/TemplateWorkspaceDormant.json.golden
+++ b/coderd/notifications/testdata/rendered-templates/webhook/TemplateWorkspaceDormant.json.golden
@@ -27,6 +27,6 @@
},
"title": "Workspace \"bobby-workspace\" marked as dormant",
"title_markdown": "Workspace \"bobby-workspace\" marked as dormant",
- "body": "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.\nDormant workspaces are automatically deleted (https://coder.com/docs/templates/schedule#dormancy-auto-deletion-enterprise) after 24 hours of inactivity.\nTo prevent deletion, use your workspace with the link below.",
- "body_markdown": "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.\nDormant workspaces are [automatically deleted](https://coder.com/docs/templates/schedule#dormancy-auto-deletion-enterprise) after 24 hours of inactivity.\nTo prevent deletion, use your workspace with the link below."
+ "body": "Your workspace bobby-workspace has been marked as dormant (https://coder.com/docs/templates/schedule#dormancy-threshold-enterprise) due to inactivity exceeding the dormancy threshold.\n\nThis workspace will be automatically deleted in 24 hours if it remains inactive.\n\nTo prevent deletion, activate your workspace using the link below.",
+ "body_markdown": "Your workspace **bobby-workspace** has been marked as [**dormant**](https://coder.com/docs/templates/schedule#dormancy-threshold-enterprise) due to inactivity exceeding the dormancy threshold.\n\nThis workspace will be automatically deleted in 24 hours if it remains inactive.\n\nTo prevent deletion, activate your workspace using the link below."
}
\ No newline at end of file