Skip to content

Commit be24cbd

Browse files
committed
fixmes
1 parent 1a941f8 commit be24cbd

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

coderd/notifications/enqueuer.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ func NewStoreEnqueuer(cfg codersdk.NotificationsConfig, store Store, helpers tem
5454

5555
// Enqueue queues a notification message for later delivery, assumes no structured input data.
5656
func (s *StoreEnqueuer) Enqueue(ctx context.Context, userID, templateID uuid.UUID, labels map[string]string, createdBy string, targets ...uuid.UUID) (*uuid.UUID, error) {
57-
return s.EnqueueData(ctx, userID, templateID, labels, map[string]any{}, createdBy, targets...)
57+
// "nil" data will be omitted while building the JSON payload.
58+
return s.EnqueueData(ctx, userID, templateID, labels, nil, createdBy, targets...)
5859
}
5960

6061
// Enqueue queues a notification message for later delivery.

coderd/notifications/notifier.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,10 +221,10 @@ func (n *notifier) prepare(ctx context.Context, msg database.AcquireNotification
221221
}
222222

223223
var title, body string
224-
if title, err = render.GoTemplate(msg.TitleTemplate, payload, nil); err != nil {
224+
if title, err = render.GoTemplate(msg.TitleTemplate, payload, nil); err != nil { // FIXME helpers
225225
return nil, xerrors.Errorf("render title: %w", err)
226226
}
227-
if body, err = render.GoTemplate(msg.BodyTemplate, payload, nil); err != nil {
227+
if body, err = render.GoTemplate(msg.BodyTemplate, payload, nil); err != nil { // FIXME helpers
228228
return nil, xerrors.Errorf("render body: %w", err)
229229
}
230230

testutil/notifications.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ type Notification struct {
2121
}
2222

2323
func (f *FakeNotificationsEnqueuer) Enqueue(ctx context.Context, userID, templateID uuid.UUID, labels map[string]string, createdBy string, targets ...uuid.UUID) (*uuid.UUID, error) {
24-
return f.EnqueueData(ctx, userID, templateID, labels, map[string]any{}, createdBy, targets...)
24+
return f.EnqueueData(ctx, userID, templateID, labels, nil, createdBy, targets...)
2525
}
2626

2727
func (f *FakeNotificationsEnqueuer) EnqueueData(_ context.Context, userID, templateID uuid.UUID, labels map[string]string, data map[string]any, createdBy string, targets ...uuid.UUID) (*uuid.UUID, error) {

0 commit comments

Comments
 (0)