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

Method getChatAutoArchiveDays

coderd/exp_chats.go:5595–5608  ·  view source on GitHub ↗

getChatAutoArchiveDays returns the deployment-wide auto-archive window. Any authenticated user can read it (same as retention days); writes require admin. nolint:revive // get-return: revive assumes get* must be a getter, but this is an HTTP handler.

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

Source from the content-addressed store, hash-verified

5593//
5594//nolint:revive // get-return: revive assumes get* must be a getter, but this is an HTTP handler.
5595func (api *API) getChatAutoArchiveDays(rw http.ResponseWriter, r *http.Request) {
5596 ctx := r.Context()
5597 autoArchiveDays, err := api.Database.GetChatAutoArchiveDays(ctx, codersdk.DefaultChatAutoArchiveDays)
5598 if err != nil {
5599 httpapi.Write(ctx, rw, http.StatusInternalServerError, codersdk.Response{
5600 Message: "Failed to get chat auto-archive days.",
5601 Detail: err.Error(),
5602 })
5603 return
5604 }
5605 httpapi.Write(ctx, rw, http.StatusOK, codersdk.ChatAutoArchiveDaysResponse{
5606 AutoArchiveDays: autoArchiveDays,
5607 })
5608}
5609
5610// Upper bound for the auto-archive window. Keep in sync with
5611// the validation schema in site/src/pages/AgentsPage/components/AutoArchiveSettings.tsx.

Callers 1

chatAutoArchiveDaysFunction · 0.80

Calls 4

WriteFunction · 0.92
ContextMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected