Skip to content

Commit aff9e6c

Browse files
committed
Review comments
Signed-off-by: Danny Kopping <danny@coder.com>
1 parent c6e75c2 commit aff9e6c

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

coderd/database/migrations/000221_notifications.up.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ CREATE INDEX idx_notification_messages_status ON notification_messages (status);
5252
-- TODO: autogenerate constants which reference the UUIDs
5353
INSERT INTO notification_templates (id, name, title_template, body_template, "group", actions)
5454
VALUES ('f517da0b-cdc9-410f-ab89-a86107c420ed', 'Workspace Deleted', E'Workspace "{{.Labels.name}}" deleted',
55-
E'Hi {{.UserName}}\n\nYour workspace **{{.Labels.name}}** was deleted.\nThe specified reason was "**{{.Labels.reason}}{{ if .Labels.initiatedBy }} ({{ .Labels.initiatedBy }}){{end}}**".',
55+
E'Hi {{.UserName}}\n\nYour workspace **{{.Labels.name}}** was deleted.\nThe specified reason was "**{{.Labels.reason}}{{ if .Labels.initiator }} ({{ .Labels.initiator }}){{end}}**".',
5656
'Workspace Events', '[
5757
{
5858
"label": "View workspaces",

coderd/notifications/dispatch/webhook.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ func (w *WebhookHandler) dispatch(msgPayload types.MessagePayload, title, body,
8888

8989
// Handle response.
9090
if resp.StatusCode/100 > 2 {
91-
// Body could be quite long here, let's grab the first 500B and hope it contains useful debug info.
92-
respBody := make([]byte, 500)
91+
// Body could be quite long here, let's grab the first 512B and hope it contains useful debug info.
92+
respBody := make([]byte, 512)
9393
lr := io.LimitReader(resp.Body, int64(len(respBody)))
9494
n, err := lr.Read(respBody)
9595
if err != nil && !errors.Is(err, io.EOF) {

coderd/notifications/events.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,8 @@ package notifications
22

33
import "github.com/google/uuid"
44

5-
// Workspaces.
6-
var TemplateWorkspaceDeleted = uuid.MustParse("f517da0b-cdc9-410f-ab89-a86107c420ed") // ...
5+
// These vars are mapped to UUIDs in the notification_templates table.
6+
// TODO: autogenerate these.
7+
8+
// Workspace-related events.
9+
var TemplateWorkspaceDeleted = uuid.MustParse("f517da0b-cdc9-410f-ab89-a86107c420ed")

0 commit comments

Comments
 (0)