feat: allow notification templates to be disabled by default (#16093)

Change as part of https://github.com/coder/coder/pull/16071

It has been decided that we want to be able to have some notification
templates be disabled _by default_
https://github.com/coder/coder/pull/16071#issuecomment-2580757061.

This adds a new column (`enabled_by_default`) to
`notification_templates` that defaults to `TRUE`. It also modifies the
`inhibit_enqueue_if_disabled` function to reject notifications for
templates that have `enabled_by_default = FALSE` with the user not
explicitly enabling it.
This commit is contained in:
Danielle Maywood
2025-01-13 15:01:47 +00:00
committed by GitHub
parent 22236f2988
commit 009069cd47
20 changed files with 231 additions and 62 deletions
+13 -11
View File
@@ -146,6 +146,7 @@ curl -X GET http://coder-server:8080/api/v2/notifications/templates/system \
{
"actions": "string",
"body_template": "string",
"enabled_by_default": true,
"group": "string",
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"kind": "string",
@@ -166,17 +167,18 @@ curl -X GET http://coder-server:8080/api/v2/notifications/templates/system \
Status Code **200**
| Name | Type | Required | Restrictions | Description |
|--------------------|--------------|----------|--------------|-------------|
| `[array item]` | array | false | | |
| `» actions` | string | false | | |
| `» body_template` | string | false | | |
| `» group` | string | false | | |
| `» id` | string(uuid) | false | | |
| `» kind` | string | false | | |
| `» method` | string | false | | |
| `» name` | string | false | | |
| `» title_template` | string | false | | |
| Name | Type | Required | Restrictions | Description |
|------------------------|--------------|----------|--------------|-------------|
| `[array item]` | array | false | | |
| `» actions` | string | false | | |
| `» body_template` | string | false | | |
| `» enabled_by_default` | boolean | false | | |
| `» group` | string | false | | |
| `» id` | string(uuid) | false | | |
| `» kind` | string | false | | |
| `» method` | string | false | | |
| `» name` | string | false | | |
| `» title_template` | string | false | | |
To perform this operation, you must be authenticated. [Learn more](authentication.md).
+12 -10
View File
@@ -3550,6 +3550,7 @@ Git clone makes use of this by parsing the URL from: 'Username for "https://gith
{
"actions": "string",
"body_template": "string",
"enabled_by_default": true,
"group": "string",
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"kind": "string",
@@ -3561,16 +3562,17 @@ Git clone makes use of this by parsing the URL from: 'Username for "https://gith
### Properties
| Name | Type | Required | Restrictions | Description |
|------------------|--------|----------|--------------|-------------|
| `actions` | string | false | | |
| `body_template` | string | false | | |
| `group` | string | false | | |
| `id` | string | false | | |
| `kind` | string | false | | |
| `method` | string | false | | |
| `name` | string | false | | |
| `title_template` | string | false | | |
| Name | Type | Required | Restrictions | Description |
|----------------------|---------|----------|--------------|-------------|
| `actions` | string | false | | |
| `body_template` | string | false | | |
| `enabled_by_default` | boolean | false | | |
| `group` | string | false | | |
| `id` | string | false | | |
| `kind` | string | false | | |
| `method` | string | false | | |
| `name` | string | false | | |
| `title_template` | string | false | | |
## codersdk.NotificationsConfig