@@ -37,7 +37,8 @@ func (h *Handlers) settingsActionsSecretSet(w http.ResponseWriter, r *http.Reque |
| 37 | 37 | return |
| 38 | 38 | } |
| 39 | 39 | if !decision.Allowed { |
| 40 | | - h.renderOrgActionsSettings(w, r, org, "secrets", orgActionsWriteDeniedMessage(decision, "Organization Actions secrets"), "") |
| 40 | + w.WriteHeader(decision.HTTPStatus()) |
| 41 | + h.renderOrgActionsSettings(w, r, org, "secrets", orgActionsWriteDeniedMessage(decision, "Organization Actions secrets", string(org.Slug)), "") |
| 41 | 42 | return |
| 42 | 43 | } |
| 43 | 44 | if h.d.SecretBox == nil { |
@@ -100,7 +101,8 @@ func (h *Handlers) settingsActionsVariableSet(w http.ResponseWriter, r *http.Req |
| 100 | 101 | return |
| 101 | 102 | } |
| 102 | 103 | if !decision.Allowed { |
| 103 | | - h.renderOrgActionsSettings(w, r, org, "variables", orgActionsWriteDeniedMessage(decision, "Organization Actions variables"), "") |
| 104 | + w.WriteHeader(decision.HTTPStatus()) |
| 105 | + h.renderOrgActionsSettings(w, r, org, "variables", orgActionsWriteDeniedMessage(decision, "Organization Actions variables", string(org.Slug)), "") |
| 104 | 106 | return |
| 105 | 107 | } |
| 106 | 108 | if err := r.ParseForm(); err != nil { |
@@ -170,7 +172,7 @@ func (h *Handlers) renderOrgActionsSettings(w http.ResponseWriter, r *http.Reque |
| 170 | 172 | "Notice": notice, |
| 171 | 173 | "FormAction": orgActionsSettingsPath(org.Slug, kind), |
| 172 | 174 | "WritesDisabled": !decision.Allowed, |
| 173 | | - "WritesDisabledMessage": orgActionsWriteDeniedMessage(decision, orgActionsFeatureLabel(kind)), |
| 175 | + "WritesDisabledMessage": orgActionsWriteDeniedMessage(decision, orgActionsFeatureLabel(kind), string(org.Slug)), |
| 174 | 176 | } |
| 175 | 177 | switch kind { |
| 176 | 178 | case "secrets": |
@@ -245,13 +247,8 @@ func orgActionsFeatureLabel(kind string) string { |
| 245 | 247 | return "Organization Actions variables" |
| 246 | 248 | } |
| 247 | 249 | |
| 248 | | -func orgActionsWriteDeniedMessage(decision entitlements.Decision, label string) string { |
| 249 | | - switch decision.Reason { |
| 250 | | - case entitlements.ReasonBillingActionNeeded: |
| 251 | | - return label + " are read-only until Team billing is brought back into good standing." |
| 252 | | - default: |
| 253 | | - return label + " require Team billing. Upgrade this organization to continue editing them." |
| 254 | | - } |
| 250 | +func orgActionsWriteDeniedMessage(decision entitlements.Decision, label, orgSlug string) string { |
| 251 | + return decision.UpgradeBanner(label, orgSlug).Message |
| 255 | 252 | } |
| 256 | 253 | |
| 257 | 254 | func (h *Handlers) recordOrgActionsAudit(r *http.Request, viewer middleware.CurrentUser, action audit.Action, orgID int64, name string) { |