Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit45094eb

Browse files
committed
make lint/fmt
Signed-off-by: Danny Kopping <danny@coder.com>
1 parent2156911 commit45094eb

File tree

4 files changed

+12
-11
lines changed

4 files changed

+12
-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
iferr!=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
iferr!=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/metrics_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,9 @@ func TestCustomMethodMetricCollection(t *testing.T) {
390390
user:=createSampleUser(t,store)
391391

392392
_,err=enq.Enqueue(ctx,user.ID,template,map[string]string{"type":"success"},"test")
393+
require.NoError(t,err)
393394
_,err=enq.Enqueue(ctx,user.ID,anotherTemplate,map[string]string{"type":"success"},"test")
395+
require.NoError(t,err)
394396

395397
mgr.Run(ctx)
396398

‎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
ifassert.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
vareg errgroup.Group
145145
for_,msg:=rangemsgs {
146-
147146
// If a notification template has been disabled by the user after a notification was enqueued, mark it as inhibited
148147
ifmsg.Disabled {
149148
failure<-n.newInhibitedDispatch(msg)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp