fix(coderd): show correct deletion time in dormancy notification (#26488)

The dormancy notification's "will be automatically deleted in X"
sentence rendered the dormancy threshold instead of the auto-delete
duration. A 30-day threshold rendered as "4 weeks" even when auto-delete
was 90 days; a 60-day threshold rendered as "1 month" with a 7-day
auto-delete. Render the countdown from the auto-delete setting, and skip
the deletion sentence entirely when auto-delete is disabled so the
notification no longer promises a deletion that will never happen.
This commit is contained in:
Zach
2026-06-18 20:17:37 +00:00
committed by GitHub
parent 992b1ffed1
commit 76fa1d4577
10 changed files with 344 additions and 31 deletions
@@ -20,7 +20,7 @@
"initiator": "autobuild",
"name": "bobby-workspace",
"reason": "breached the template's threshold for inactivity",
"timeTilDormant": "24 hours"
"timeTilDelete": "24 hours"
},
"data": null,
"targets": null
@@ -0,0 +1,31 @@
{
"_version": "1.1",
"msg_id": "00000000-0000-0000-0000-000000000000",
"payload": {
"_version": "1.2",
"notification_name": "Workspace Marked as Dormant",
"notification_template_id": "00000000-0000-0000-0000-000000000000",
"user_id": "00000000-0000-0000-0000-000000000000",
"user_email": "bobby@coder.com",
"user_name": "Bobby",
"user_username": "bobby",
"actions": [
{
"label": "View workspace",
"url": "http://test.com/@bobby/bobby-workspace"
}
],
"labels": {
"dormancyHours": "24",
"initiator": "autobuild",
"name": "bobby-workspace",
"reason": "breached the template's threshold for inactivity"
},
"data": null,
"targets": null
},
"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/admin/templates/managing-templates/schedule#dormancy-threshold) due to inactivity exceeding the dormancy threshold.\n\nActivate your workspace using the link below to resume working in it.",
"body_markdown": "Your workspace **bobby-workspace** has been marked as [**dormant**](https://coder.com/docs/admin/templates/managing-templates/schedule#dormancy-threshold) due to inactivity exceeding the dormancy threshold.\n\nActivate your workspace using the link below to resume working in it."
}