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

Commit694df11

Browse files
committed
Clarification on enqueue failure
Test fixSigned-off-by: Danny Kopping <danny@coder.com>
1 parentd587308 commit694df11

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

‎coderd/notifications/enqueuer.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,11 @@ func (s *StoreEnqueuer) Enqueue(ctx context.Context, userID, templateID uuid.UUI
8383
CreatedBy:createdBy,
8484
})
8585
iferr!=nil {
86+
// We have a trigger on the notification_messages table named `inhibit_enqueue_if_disabled` which prevents messages
87+
// from being enqueued if the user has disabled them via notification_preferences. The trigger will fail the insertion
88+
// with the message "cannot enqueue message: user has disabled this notification".
89+
//
90+
// This is more efficient than fetching the user's preferences for each enqueue, and centralizes the business logic.
8691
ifstrings.Contains(err.Error(),ErrCannotEnqueueDisabledNotification.Error()) {
8792
returnnil,ErrCannotEnqueueDisabledNotification
8893
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp