mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
fix: label premium features in middleware error (#14360)
Previously, all features were called enterprise in the license check middleware.
This commit is contained in:
@@ -364,8 +364,12 @@ func (api *API) RequireFeatureMW(feat codersdk.FeatureName) func(http.Handler) h
|
||||
enabled := api.entitlements.Features[feat].Enabled
|
||||
api.entitlementsMu.RUnlock()
|
||||
if !enabled {
|
||||
licenseType := "a Premium"
|
||||
if feat.Enterprise() {
|
||||
licenseType = "an Enterprise"
|
||||
}
|
||||
httpapi.Write(r.Context(), rw, http.StatusForbidden, codersdk.Response{
|
||||
Message: fmt.Sprintf("%s is an Enterprise feature. Contact sales!", feat.Humanize()),
|
||||
Message: fmt.Sprintf("%s is %s feature. Contact sales!", feat.Humanize(), licenseType),
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user