Skip to content

fix(promocode): clarify Apply-to-all scope (Audience: All only)#926

Closed
caseylocker wants to merge 2 commits into
masterfrom
feat/promo-code-apply-to-all-audience-restriction
Closed

fix(promocode): clarify Apply-to-all scope (Audience: All only)#926
caseylocker wants to merge 2 commits into
masterfrom
feat/promo-code-apply-to-all-audience-restriction

Conversation

@caseylocker
Copy link
Copy Markdown

Summary

The backend tightens canBeAppliedTo() so the implicit "apply to all" branch only covers Audience = All ticket types (see companion summit-api PR). This change updates the admin copy so the checkbox label and a new helper-text row name the restriction explicitly. WithInvitation, WithoutInvitation, and WithPromoCode ticket types must be opted in via the picker after saving.

No JS logic change — the apply_to_all_tix flag is and remains UI-only (deleted before send at src/actions/promocode-actions.js:160 and re-derived from ticket_types_rules.length === 0 at src/reducers/promocodes/promocode-reducer.js:179).

What changed

  • src/i18n/en.jsonapply_to_all_tix rewritten to "Apply to all ticket types (Audience: All)"; new apply_to_all_tix_helper key.
  • src/components/forms/promocode-form/forms/discount-base-pc-form.js — added <small className="form-text text-muted"> helper row beneath the checkbox.
  • src/components/forms/speakers-promo-code-spec-form.js — same i18n key is rendered under the AUTO_GENERATED_SPEAKERS_DISCOUNT_CODE branch; added the matching helper row there.
  • src/components/forms/promocode-form/__tests__/promocode-form.integration.test.js — 7 new test cases (6 discount-code classes × label/helper assertions + one helper-renders-when-unchecked case).
  • doc/promo-code-apply-to-all-audience-restriction.md — dedicated spec.

AC5 wording note

The ClickUp acceptance criterion #5 says "submitting apply_to_all_ticket_types = true resolves to Audience = All only, regardless of frontend." No such payload field is sent — apply_to_all_tix is a UI-only flag and is stripped before the API call. The actual enforcement is on the backend at the entity level (canBeAppliedTo). See the companion summit-api PR. A hostile client cannot bypass — there's no field to forge.

Test plan

  • yarn test --watchAll=false src/components/forms/promocode-form/__tests__/promocode-form.integration.test.js — 38/38 pass
  • yarn test --watchAll=false --testPathPatterns="promocode|promo-code|methods" — 97/97 pass
  • Manual: against the dev stack, open a discount-code editor (any of MEMBER/SPEAKER/SPONSOR/SUMMIT/SPEAKERS/DOMAIN_AUTHORIZED *_DISCOUNT_CODE) — verify the new label + helper render and that checking/unchecking still hides/shows the per-type picker.
  • Manual: open the speakers list page "Generate auto promo codes" flow → select AUTO_GENERATED_SPEAKERS_DISCOUNT_CODE → confirm the same label + helper render.

Notes

  • 7 pre-existing test failures in the repo are unrelated (actions.test.js, dropbox-sync-actions.test.js, edit-sponsor-page.test.js) — same failures present on origin/master baseline.

Backend tightens canBeAppliedTo() so the implicit "apply to all" branch only
covers Audience = All ticket types (see companion API SDS). This change
updates the admin copy so the checkbox label and a new helper-text row name
the restriction explicitly. WithInvitation, WithoutInvitation, and
WithPromoCode ticket types must be opted in via the picker after saving.

No JS logic change — the apply_to_all_tix flag is and remains UI-only.

Refs: ClickUp 86b9vrpxp; companion summit-api branch
feat/promo-code-apply-to-all-audience-restriction
The `edit_promocode.apply_to_all_tix` i18n key is also rendered by
speakers-promo-code-spec-form.js under the AUTO_GENERATED_SPEAKERS_DISCOUNT_CODE
branch (a discount-code path). The label update from the prior commit lands
there too, so the same helper row belongs beneath that checkbox to keep the
admin clarity consistent across both forms.

Spec line citations updated to reflect the actual en.json position.

Refs: ClickUp 86b9vrpxp; Codex review of a694ada.
@caseylocker caseylocker self-assigned this May 11, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 11, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: be152289-e4e1-412a-a418-24203362d461

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/promo-code-apply-to-all-audience-restriction

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@caseylocker caseylocker deleted the feat/promo-code-apply-to-all-audience-restriction branch May 11, 2026 15:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant