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)
| 5593 | // |
| 5594 | //nolint:revive // get-return: revive assumes get* must be a getter, but this is an HTTP handler. |
| 5595 | func (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. |
no test coverage detected