Skip to content

Commit aa9f5a0

Browse files
committed
make lint/fmt
Signed-off-by: Danny Kopping <danny@coder.com>
1 parent 0abd613 commit aa9f5a0

File tree

3 files changed

+10
-11
lines changed

3 files changed

+10
-11
lines changed

coderd/notifications.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ func (api *API) putUserNotificationPreferences(rw http.ResponseWriter, r *http.R
219219

220220
updated, err := api.Database.UpdateUserNotificationPreferences(ctx, input)
221221
if err != nil {
222-
logger.Error(ctx, "failed to update", slog.Error(err))
222+
logger.Error(ctx, "failed to update preferences", slog.Error(err))
223223

224224
httpapi.Write(r.Context(), rw, http.StatusInternalServerError, codersdk.Response{
225225
Message: "Failed to update user notifications preferences.",
@@ -228,11 +228,11 @@ func (api *API) putUserNotificationPreferences(rw http.ResponseWriter, r *http.R
228228
return
229229
}
230230

231-
logger.Info(ctx, "updated", slog.F("count", updated))
231+
logger.Info(ctx, "updated preferences", slog.F("count", updated))
232232

233233
userPrefs, err := api.Database.GetUserNotificationPreferences(ctx, user.ID)
234234
if err != nil {
235-
logger.Error(ctx, "failed to retrieve", slog.Error(err))
235+
logger.Error(ctx, "failed to retrieve preferences", slog.Error(err))
236236

237237
httpapi.Write(r.Context(), rw, http.StatusInternalServerError, codersdk.Response{
238238
Message: "Failed to retrieve user notifications preferences.",

coderd/notifications/notifications_test.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -723,17 +723,17 @@ func TestDisabledBeforeEnqueue(t *testing.T) {
723723
user := createSampleUser(t, db)
724724

725725
// WHEN: the user has a preference set to not receive the "workspace deleted" notification
726-
templateId := notifications.TemplateWorkspaceDeleted
726+
templateID := notifications.TemplateWorkspaceDeleted
727727
n, err := db.UpdateUserNotificationPreferences(ctx, database.UpdateUserNotificationPreferencesParams{
728728
UserID: user.ID,
729-
NotificationTemplateIds: []uuid.UUID{templateId},
729+
NotificationTemplateIds: []uuid.UUID{templateID},
730730
Disableds: []bool{true},
731731
})
732732
require.NoError(t, err, "failed to set preferences")
733733
require.EqualValues(t, 1, n, "unexpected number of affected rows")
734734

735735
// THEN: enqueuing the "workspace deleted" notification should fail with an error
736-
_, err = enq.Enqueue(ctx, user.ID, templateId, map[string]string{}, "test")
736+
_, err = enq.Enqueue(ctx, user.ID, templateID, map[string]string{}, "test")
737737
require.ErrorIs(t, err, notifications.ErrCannotEnqueueDisabledNotification, "enqueueing did not fail with expected error")
738738
}
739739

@@ -763,14 +763,14 @@ func TestDisabledAfterEnqueue(t *testing.T) {
763763
user := createSampleUser(t, db)
764764

765765
// GIVEN: a notification is enqueued which has not (yet) been disabled
766-
templateId := notifications.TemplateWorkspaceDeleted
767-
msgId, err := enq.Enqueue(ctx, user.ID, templateId, map[string]string{}, "test")
766+
templateID := notifications.TemplateWorkspaceDeleted
767+
msgID, err := enq.Enqueue(ctx, user.ID, templateID, map[string]string{}, "test")
768768
require.NoError(t, err)
769769

770770
// Disable the notification template.
771771
n, err := db.UpdateUserNotificationPreferences(ctx, database.UpdateUserNotificationPreferencesParams{
772772
UserID: user.ID,
773-
NotificationTemplateIds: []uuid.UUID{templateId},
773+
NotificationTemplateIds: []uuid.UUID{templateID},
774774
Disableds: []bool{true},
775775
})
776776
require.NoError(t, err, "failed to set preferences")
@@ -787,7 +787,7 @@ func TestDisabledAfterEnqueue(t *testing.T) {
787787
})
788788
assert.NoError(ct, err)
789789
if assert.Equal(ct, len(m), 1) {
790-
assert.Equal(ct, m[0].ID.String(), msgId.String())
790+
assert.Equal(ct, m[0].ID.String(), msgID.String())
791791
assert.Contains(ct, m[0].StatusReason.String, "disabled by user")
792792
}
793793
}, testutil.WaitLong, testutil.IntervalFast, "did not find the expected inhibited message")

coderd/notifications/notifier.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,6 @@ func (n *notifier) process(ctx context.Context, success chan<- dispatchResult, f
143143

144144
var eg errgroup.Group
145145
for _, msg := range msgs {
146-
147146
// If a notification template has been disabled by the user after a notification was enqueued, mark it as inhibited
148147
if msg.Disabled {
149148
failure <- n.newInhibitedDispatch(msg)

0 commit comments

Comments
 (0)