From 521a13b65c3e5fa4bb9dff414ec5cb7aa4bcdc34 Mon Sep 17 00:00:00 2001
From: defelmnq
Date: Tue, 25 Mar 2025 23:38:23 +0000
Subject: [PATCH 1/2] improve dormant workspace notification wording
---
...ve_dormant_workspace_notification.down.sql | 3 +++
...rove_dormant_workspace_notification.up.sql | 3 +++
.../smtp/TemplateWorkspaceDormant.html.golden | 20 ++++++++-----------
.../TemplateWorkspaceDormant.json.golden | 4 ++--
4 files changed, 16 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 0000000000000..1414f4dfa413b
--- /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 0000000000000..69dda251a3d4b
--- /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.' ||
+ E'This workspace will be automatically deleted in {{.Labels.timeTilDormant}} if it remains inactive.' ||
+ 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 40bd6fc135469..e446f7ea58ce9 100644
--- a/coderd/notifications/testdata/rendered-templates/smtp/TemplateWorkspaceDormant.html.golden
+++ b/coderd/notifications/testdata/rendered-templates/smtp/TemplateWorkspaceDormant.html.golden
@@ -13,12 +13,10 @@ 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 delet=
+ed in 24 hours if it remains inactive.To prevent deletion, activate your wo=
+rkspace using the link below.
View workspace: http://test.com/@bobby/bobby-workspace
@@ -54,12 +52,10 @@ 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 i=
+f it remains inactive.To prevent deletion, activate your workspace using th=
+e 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 5cfc61dea2840..392e8048e3dad 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.This workspace will be automatically deleted in 24 hours if it remains inactive.To 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.This workspace will be automatically deleted in 24 hours if it remains inactive.To prevent deletion, activate your workspace using the link below."
}
\ No newline at end of file
From b51c005c53c2dc4f56c82b319154b8fda9d8a027 Mon Sep 17 00:00:00 2001
From: defelmnq
Date: Wed, 26 Mar 2025 14:13:48 +0000
Subject: [PATCH 2/2] fix templates
---
...prove_dormant_workspace_notification.up.sql | 4 ++--
.../smtp/TemplateWorkspaceDormant.html.golden | 18 ++++++++++++------
.../TemplateWorkspaceDormant.json.golden | 4 ++--
3 files changed, 16 insertions(+), 10 deletions(-)
diff --git a/coderd/database/migrations/000311_improve_dormant_workspace_notification.up.sql b/coderd/database/migrations/000311_improve_dormant_workspace_notification.up.sql
index 69dda251a3d4b..146ef365dafce 100644
--- a/coderd/database/migrations/000311_improve_dormant_workspace_notification.up.sql
+++ b/coderd/database/migrations/000311_improve_dormant_workspace_notification.up.sql
@@ -1,3 +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.' ||
- E'This workspace will be automatically deleted in {{.Labels.timeTilDormant}} if it remains inactive.' ||
+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 e446f7ea58ce9..ee3021c18cef1 100644
--- a/coderd/notifications/testdata/rendered-templates/smtp/TemplateWorkspaceDormant.html.golden
+++ b/coderd/notifications/testdata/rendered-templates/smtp/TemplateWorkspaceDormant.html.golden
@@ -14,9 +14,12 @@ Hi Bobby,
Your workspace bobby-workspace has been marked as dormant (https://coder.co=
m/docs/templates/schedule#dormancy-threshold-enterprise) due to inactivity =
-exceeding the dormancy threshold.This workspace will be automatically delet=
-ed in 24 hours if it remains inactive.To prevent deletion, activate your wo=
-rkspace using the link below.
+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
@@ -53,9 +56,12 @@ argin: 8px 0 32px; line-height: 1.5;">
Your workspace bobby-workspace has been marked =
as dormant due to inactivity exceeding the do=
-rmancy threshold.This workspace will be automatically deleted in 24 hours i=
-f it remains inactive.To prevent deletion, activate your workspace using th=
-e link below.
+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 392e8048e3dad..2d85eb6e6b7e1 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) due to inactivity exceeding the dormancy threshold.This workspace will be automatically deleted in 24 hours if it remains inactive.To 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.This workspace will be automatically deleted in 24 hours if it remains inactive.To prevent deletion, activate your workspace using 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