feat(coderd): notify when workspace is marked as dormant (#13868)

This commit is contained in:
Bruno Quaresma
2024-07-24 13:38:21 -03:00
committed by GitHub
parent ccb5b4df80
commit 0d9615b4fd
25 changed files with 650 additions and 118 deletions
+10 -4
View File
@@ -7,9 +7,8 @@ import (
"github.com/google/uuid"
)
type FakeNotificationEnqueuer struct {
mu sync.Mutex
type FakeNotificationsEnqueuer struct {
mu sync.Mutex
Sent []*Notification
}
@@ -20,7 +19,7 @@ type Notification struct {
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) {
func (f *FakeNotificationsEnqueuer) 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()
@@ -35,3 +34,10 @@ func (f *FakeNotificationEnqueuer) Enqueue(_ context.Context, userID, templateID
id := uuid.New()
return &id, nil
}
func (f *FakeNotificationsEnqueuer) Clear() {
f.mu.Lock()
defer f.mu.Unlock()
f.Sent = nil
}