feat: notify on task auto pause, manual pause and manual resume (#22050)

This commit is contained in:
Danielle Maywood
2026-02-18 16:30:16 +00:00
committed by GitHub
parent dcdca814d6
commit 31c1279202
12 changed files with 569 additions and 37 deletions
@@ -0,0 +1,85 @@
From: system@coder.com
To: bobby@coder.com
Subject: Task 'my-task' is paused
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
MIME-Version: 1.0
--bbe61b741255b6098bb6b3c1f41b885773df633cb18d2a3002b68e4bc9c4
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset=UTF-8
Hi Bobby,
The task 'my-task' was paused (idle timeout).
View task: http://test.com/tasks/bobby/00000000-0000-0000-0000-000000000000
View workspace: http://test.com/@bobby/my-workspace
--bbe61b741255b6098bb6b3c1f41b885773df633cb18d2a3002b68e4bc9c4
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset=UTF-8
<!doctype html>
<html lang=3D"en">
<head>
<meta charset=3D"UTF-8" />
<meta name=3D"viewport" content=3D"width=3Ddevice-width, initial-scale=
=3D1.0" />
<title>Task 'my-task' is paused</title>
</head>
<body style=3D"margin: 0; padding: 0; font-family: -apple-system, system-=
ui, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarel=
l', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif; color: #020617=
; background: #f8fafc;">
<div style=3D"max-width: 600px; margin: 20px auto; padding: 60px; borde=
r: 1px solid #e2e8f0; border-radius: 8px; background-color: #fff; text-alig=
n: left; font-size: 14px; line-height: 1.5;">
<div style=3D"text-align: center;">
<img src=3D"https://coder.com/coder-logo-horizontal.png" alt=3D"Cod=
er Logo" style=3D"height: 40px;" />
</div>
<h1 style=3D"text-align: center; font-size: 24px; font-weight: 400; m=
argin: 8px 0 32px; line-height: 1.5;">
Task 'my-task' is paused
</h1>
<div style=3D"line-height: 1.5;">
<p>Hi Bobby,</p>
<p>The task &lsquo;my-task&rsquo; was paused (idle timeout).</p>
</div>
<div style=3D"text-align: center; margin-top: 32px;">
=20
<a href=3D"http://test.com/tasks/bobby/00000000-0000-0000-0000-0000=
00000000" style=3D"display: inline-block; padding: 13px 24px; background-co=
lor: #020617; color: #f8fafc; text-decoration: none; border-radius: 8px; ma=
rgin: 0 4px;">
View task
</a>
=20
<a href=3D"http://test.com/@bobby/my-workspace" style=3D"display: i=
nline-block; padding: 13px 24px; background-color: #020617; color: #f8fafc;=
text-decoration: none; border-radius: 8px; margin: 0 4px;">
View workspace
</a>
=20
</div>
<div style=3D"border-top: 1px solid #e2e8f0; color: #475569; font-siz=
e: 12px; margin-top: 64px; padding-top: 24px; line-height: 1.6;">
<p>&copy;&nbsp;2024&nbsp;Coder. All rights reserved&nbsp;-&nbsp;<a =
href=3D"http://test.com" style=3D"color: #2563eb; text-decoration: none;">h=
ttp://test.com</a></p>
<p><a href=3D"http://test.com/settings/notifications" style=3D"colo=
r: #2563eb; text-decoration: none;">Click here to manage your notification =
settings</a></p>
<p><a href=3D"http://test.com/settings/notifications?disabled=3D2a7=
4f3d3-ab09-4123-a4a5-ca238f4f65a1" style=3D"color: #2563eb; text-decoration=
: none;">Stop receiving emails like this</a></p>
</div>
</div>
</body>
</html>
--bbe61b741255b6098bb6b3c1f41b885773df633cb18d2a3002b68e4bc9c4--
@@ -0,0 +1,85 @@
From: system@coder.com
To: bobby@coder.com
Subject: Task 'my-task' has resumed
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
MIME-Version: 1.0
--bbe61b741255b6098bb6b3c1f41b885773df633cb18d2a3002b68e4bc9c4
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset=UTF-8
Hi Bobby,
The task 'my-task' has resumed.
View task: http://test.com/tasks/bobby/00000000-0000-0000-0000-000000000001
View workspace: http://test.com/@bobby/my-workspace
--bbe61b741255b6098bb6b3c1f41b885773df633cb18d2a3002b68e4bc9c4
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset=UTF-8
<!doctype html>
<html lang=3D"en">
<head>
<meta charset=3D"UTF-8" />
<meta name=3D"viewport" content=3D"width=3Ddevice-width, initial-scale=
=3D1.0" />
<title>Task 'my-task' has resumed</title>
</head>
<body style=3D"margin: 0; padding: 0; font-family: -apple-system, system-=
ui, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarel=
l', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif; color: #020617=
; background: #f8fafc;">
<div style=3D"max-width: 600px; margin: 20px auto; padding: 60px; borde=
r: 1px solid #e2e8f0; border-radius: 8px; background-color: #fff; text-alig=
n: left; font-size: 14px; line-height: 1.5;">
<div style=3D"text-align: center;">
<img src=3D"https://coder.com/coder-logo-horizontal.png" alt=3D"Cod=
er Logo" style=3D"height: 40px;" />
</div>
<h1 style=3D"text-align: center; font-size: 24px; font-weight: 400; m=
argin: 8px 0 32px; line-height: 1.5;">
Task 'my-task' has resumed
</h1>
<div style=3D"line-height: 1.5;">
<p>Hi Bobby,</p>
<p>The task &lsquo;my-task&rsquo; has resumed.</p>
</div>
<div style=3D"text-align: center; margin-top: 32px;">
=20
<a href=3D"http://test.com/tasks/bobby/00000000-0000-0000-0000-0000=
00000001" style=3D"display: inline-block; padding: 13px 24px; background-co=
lor: #020617; color: #f8fafc; text-decoration: none; border-radius: 8px; ma=
rgin: 0 4px;">
View task
</a>
=20
<a href=3D"http://test.com/@bobby/my-workspace" style=3D"display: i=
nline-block; padding: 13px 24px; background-color: #020617; color: #f8fafc;=
text-decoration: none; border-radius: 8px; margin: 0 4px;">
View workspace
</a>
=20
</div>
<div style=3D"border-top: 1px solid #e2e8f0; color: #475569; font-siz=
e: 12px; margin-top: 64px; padding-top: 24px; line-height: 1.6;">
<p>&copy;&nbsp;2024&nbsp;Coder. All rights reserved&nbsp;-&nbsp;<a =
href=3D"http://test.com" style=3D"color: #2563eb; text-decoration: none;">h=
ttp://test.com</a></p>
<p><a href=3D"http://test.com/settings/notifications" style=3D"colo=
r: #2563eb; text-decoration: none;">Click here to manage your notification =
settings</a></p>
<p><a href=3D"http://test.com/settings/notifications?disabled=3D843=
ee9c3-a8fb-4846-afa9-977bec578649" style=3D"color: #2563eb; text-decoration=
: none;">Stop receiving emails like this</a></p>
</div>
</div>
</body>
</html>
--bbe61b741255b6098bb6b3c1f41b885773df633cb18d2a3002b68e4bc9c4--
@@ -0,0 +1,35 @@
{
"_version": "1.1",
"msg_id": "00000000-0000-0000-0000-000000000000",
"payload": {
"_version": "1.2",
"notification_name": "Task Paused",
"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 task",
"url": "http://test.com/tasks/bobby/00000000-0000-0000-0000-000000000000"
},
{
"label": "View workspace",
"url": "http://test.com/@bobby/my-workspace"
}
],
"labels": {
"pause_reason": "idle timeout",
"task": "my-task",
"task_id": "00000000-0000-0000-0000-000000000000",
"workspace": "my-workspace"
},
"data": {},
"targets": null
},
"title": "Task 'my-task' is paused",
"title_markdown": "Task 'my-task' is paused",
"body": "The task 'my-task' was paused (idle timeout).",
"body_markdown": "The task 'my-task' was paused (idle timeout)."
}
@@ -0,0 +1,34 @@
{
"_version": "1.1",
"msg_id": "00000000-0000-0000-0000-000000000000",
"payload": {
"_version": "1.2",
"notification_name": "Task Resumed",
"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 task",
"url": "http://test.com/tasks/bobby/00000000-0000-0000-0000-000000000000"
},
{
"label": "View workspace",
"url": "http://test.com/@bobby/my-workspace"
}
],
"labels": {
"task": "my-task",
"task_id": "00000000-0000-0000-0000-000000000000",
"workspace": "my-workspace"
},
"data": {},
"targets": null
},
"title": "Task 'my-task' has resumed",
"title_markdown": "Task 'my-task' has resumed",
"body": "The task 'my-task' has resumed.",
"body_markdown": "The task 'my-task' has resumed."
}