mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
chore: create ResourceNotificationMessage and AsNotifier (#15301)
Closes https://github.com/coder/coder/issues/15213 This PR enables sending notifications without requiring the auth system context, instead using a new auth notifier context.
This commit is contained in:
+2
-2
@@ -298,8 +298,8 @@ func (api *API) postRequestOneTimePasscode(rw http.ResponseWriter, r *http.Reque
|
||||
|
||||
func (api *API) notifyUserRequestedOneTimePasscode(ctx context.Context, user database.User, passcode string) error {
|
||||
_, err := api.NotificationsEnqueuer.Enqueue(
|
||||
//nolint:gocritic // We need the system auth context to be able to send the user their one-time passcode.
|
||||
dbauthz.AsSystemRestricted(ctx),
|
||||
//nolint:gocritic // We need the notifier auth context to be able to send the user their one-time passcode.
|
||||
dbauthz.AsNotifier(ctx),
|
||||
user.ID,
|
||||
notifications.TemplateUserRequestedOneTimePasscode,
|
||||
map[string]string{"one_time_passcode": passcode},
|
||||
|
||||
Reference in New Issue
Block a user