-
Notifications
You must be signed in to change notification settings - Fork 953
feat: notify on successful autoupdate #13903
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
5fa194c
8b8b00b
b5fa318
3754f79
3cb5184
c2ebada
b601c22
acf9394
99b1802
8c7b06e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
DELETE FROM notification_templates WHERE id = 'c34a0c09-0704-4cac-bd1c-0c0146811c2b'; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
INSERT INTO notification_templates (id, name, title_template, body_template, "group", actions) | ||
VALUES ('c34a0c09-0704-4cac-bd1c-0c0146811c2b', 'Workspace updated automatically', E'Workspace "{{.Labels.name}}" updated automatically', | ||
E'Hi {{.UserName}}\n\Your workspace **{{.Labels.name}}** has been updated automatically to the latest template version ({{.Labels.template_version_name}}).', | ||
'Workspace Events', '[ | ||
{ | ||
"label": "View workspace", | ||
"url": "{{ base_url }}/@{{.UserName}}/{{.Labels.name}}" | ||
} | ||
]'::jsonb); |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In the other PR, we did this a bit differently. We added this fake helper into the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I'm aware of it. This is an alternative approach, and I'm happy to leave it or switch to the other form. @dannykopping any preference? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I prefer names which are explicit and clear, so I prefer There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I will wait with merging this PR until Bruno merges #13868, then adjust it. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package notiffake | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: I like splitting this out but I think the name is too "cute". There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Alright, I decided to merge it as is, and refactor/unify once #13868 is merged. |
||
|
||
import ( | ||
"context" | ||
"sync" | ||
|
||
"github.com/google/uuid" | ||
) | ||
|
||
type FakeNotificationEnqueuer struct { | ||
mu sync.Mutex | ||
|
||
Sent []*Notification | ||
} | ||
|
||
type Notification struct { | ||
UserID, TemplateID uuid.UUID | ||
Labels map[string]string | ||
CreatedBy string | ||
Targets []uuid.UUID | ||
} | ||
|
||
func (f *FakeNotificationEnqueuer) Enqueue(_ context.Context, userID, templateID uuid.UUID, labels map[string]string, createdBy string, targets ...uuid.UUID) (*uuid.UUID, error) { | ||
f.mu.Lock() | ||
defer f.mu.Unlock() | ||
|
||
f.Sent = append(f.Sent, &Notification{ | ||
UserID: userID, | ||
TemplateID: templateID, | ||
Labels: labels, | ||
CreatedBy: createdBy, | ||
Targets: targets, | ||
}) | ||
|
||
id := uuid.New() | ||
return &id, nil | ||
} |
Uh oh!
There was an error while loading. Please reload this page.