diff --git a/site/src/pages/DeploymentSettingsPage/NotificationsPage/NotificationsPage.stories.tsx b/site/src/pages/DeploymentSettingsPage/NotificationsPage/NotificationsPage.stories.tsx index 7e107f91fd..4ba9c2f322 100644 --- a/site/src/pages/DeploymentSettingsPage/NotificationsPage/NotificationsPage.stories.tsx +++ b/site/src/pages/DeploymentSettingsPage/NotificationsPage/NotificationsPage.stories.tsx @@ -69,6 +69,7 @@ export const Events: Story = { await canvas.findByText("Template Events"); await canvas.findByText("User Events"); await canvas.findByText("Workspace Events"); + await canvas.findByText("Task Events"); // Custom notification template await canvas.findByText("Custom Events"); diff --git a/site/src/pages/UserSettingsPage/NotificationsPage/NotificationsPage.stories.tsx b/site/src/pages/UserSettingsPage/NotificationsPage/NotificationsPage.stories.tsx index f908a3a4ed..166531eb69 100644 --- a/site/src/pages/UserSettingsPage/NotificationsPage/NotificationsPage.stories.tsx +++ b/site/src/pages/UserSettingsPage/NotificationsPage/NotificationsPage.stories.tsx @@ -54,7 +54,22 @@ const meta = { export default meta; type Story = StoryObj; -export const Default: Story = {}; +export const Default: Story = { + play: async ({ canvasElement }) => { + const canvas = within(canvasElement); + + await Promise.all([ + // System notification templates + canvas.findByRole("checkbox", { name: "Task Events" }), + canvas.findByRole("checkbox", { name: "Template Events" }), + canvas.findByRole("checkbox", { name: "User Events" }), + canvas.findByRole("checkbox", { name: "Workspace Events" }), + + // Custom notification template + canvas.findByRole("checkbox", { name: "Custom Events" }), + ]); + }, +}; export const ToggleGroup: Story = { play: async ({ canvasElement }) => { diff --git a/site/src/pages/UserSettingsPage/NotificationsPage/NotificationsPage.tsx b/site/src/pages/UserSettingsPage/NotificationsPage/NotificationsPage.tsx index d077e4e456..39bac4df71 100644 --- a/site/src/pages/UserSettingsPage/NotificationsPage/NotificationsPage.tsx +++ b/site/src/pages/UserSettingsPage/NotificationsPage/NotificationsPage.tsx @@ -228,12 +228,12 @@ function canSeeNotificationGroup( permissions: Permissions, ): boolean { switch (group) { - case "Workspace Events": - return true; case "Template Events": return permissions.createTemplates; case "User Events": return permissions.createUser; + case "Workspace Events": + case "Task Events": case "Custom Events": return true; default: diff --git a/site/src/testHelpers/entities.ts b/site/src/testHelpers/entities.ts index 18b5c3d65b..19c414bdd3 100644 --- a/site/src/testHelpers/entities.ts +++ b/site/src/testHelpers/entities.ts @@ -4702,6 +4702,31 @@ export const MockSystemNotificationTemplates: TypesGen.NotificationTemplate[] = kind: "system", enabled_by_default: true, }, + { + id: "d4a6271c-cced-4ed0-84ad-afd02a9c7799", + name: "Task Idle", + title_template: "Task '{{.Labels.workspace}}' is idle", + body_template: "The task '{{.Labels.task}}' is idle and ready for input.", + actions: + '[{"url": "{{base_url}}/tasks/{{.UserUsername}}/{{.Labels.workspace}}", "label": "View task"}, {"url": "{{base_url}}/@{{.UserUsername}}/{{.Labels.workspace}}", "label": "View workspace"}]', + group: "Task Events", + method: "", + kind: "system", + enabled_by_default: true, + }, + { + id: "bd4b7168-d05e-4e19-ad0f-3593b77aa90f", + name: "Task Working", + title_template: "Task '{{.Labels.workspace}}' is working", + body_template: + "The task '{{.Labels.task}}' transitioned to a working state.", + actions: + '[{"url": "{{base_url}}/tasks/{{.UserUsername}}/{{.Labels.workspace}}", "label": "View task"}, {"url": "{{base_url}}/@{{.UserUsername}}/{{.Labels.workspace}}", "label": "View workspace"}]', + group: "Task Events", + method: "", + kind: "system", + enabled_by_default: true, + }, ]; export const MockCustomNotificationTemplates: TypesGen.NotificationTemplate[] =