MCPcopy Index your code
hub / github.com/coder/coder / markAllInboxNotificationsAsRead

Method markAllInboxNotificationsAsRead

coderd/inboxnotifications.go:444–463  ·  view source on GitHub ↗

markAllInboxNotificationsAsRead marks as read all unread notifications for authenticated user. @Summary Mark all unread notifications as read @ID mark-all-unread-notifications-as-read @Security CoderSessionToken @Tags Notifications @Success 204 @Router /api/v2/notifications/inbox/mark-all-as-read [p

(rw http.ResponseWriter, r *http.Request)

Source from the content-addressed store, hash-verified

442// @Success 204
443// @Router /api/v2/notifications/inbox/mark-all-as-read [put]
444func (api *API) markAllInboxNotificationsAsRead(rw http.ResponseWriter, r *http.Request) {
445 var (
446 ctx = r.Context()
447 apikey = httpmw.APIKey(r)
448 )
449
450 err := api.Database.MarkAllInboxNotificationsAsRead(ctx, database.MarkAllInboxNotificationsAsReadParams{
451 UserID: apikey.UserID,
452 ReadAt: sql.NullTime{Time: dbtime.Now(), Valid: true},
453 })
454 if err != nil {
455 api.Logger.Error(ctx, "failed to mark all unread notifications as read", slog.Error(err))
456 httpapi.Write(ctx, rw, http.StatusInternalServerError, codersdk.Response{
457 Message: "Failed to mark all unread notifications as read.",
458 })
459 return
460 }
461
462 rw.WriteHeader(http.StatusNoContent)
463}

Callers

nothing calls this directly

Calls 7

APIKeyFunction · 0.92
NowFunction · 0.92
WriteFunction · 0.92
ContextMethod · 0.65
ErrorMethod · 0.45
WriteHeaderMethod · 0.45

Tested by

no test coverage detected