Skip to content

Selection Plans CRUD Update#13

Merged
smarcet merged 1 commit intomasterfrom
feature/selection_plans_extra_questions
May 27, 2021
Merged

Selection Plans CRUD Update#13
smarcet merged 1 commit intomasterfrom
feature/selection_plans_extra_questions

Conversation

@smarcet
Copy link
Copy Markdown

@smarcet smarcet commented May 27, 2021

  • added extra questions per selection plan CRUD
  • added extra questions on presentation CRUD
  • added extra questions answers on presentation CSV export

Signed-off-by: smarcet smarcet@gmail.com

* added extra questions per selection plan CRUD
* added extra questions on presentation CRUD
* added extra questions answers on presentation CSV export

Signed-off-by: smarcet <smarcet@gmail.com>
@smarcet smarcet merged commit aa04783 into master May 27, 2021
caseylocker added a commit that referenced this pull request Mar 26, 2026
Match the canonical URL prefix introduced in dropbox-materializer PR #13
(fix/api-url-versioning). All four endpoints updated from /api/sync/
to /api/v1/sync/.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
smarcet pushed a commit that referenced this pull request Mar 26, 2026
* feat: Add Dropbox sync controls — toggle, Rebuild All, Resync Room (#86b8tx6pv)

Show Admin UI for Track 3 of the dropbox-materializer integration:
- Sync toggle (react-switch) + Rebuild button on Location List page
- Per-room resync icon in Rooms table Actions column (uicore custom action)
- Redux actions/reducer hitting materializer API directly (OAuth2 via uicore)
- Feature-flagged on DROPBOX_MATERIALIZER_API_BASE_URL env var

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: address PR 833 review — error handling, scopes, tests, and misc fixes

- Add .catch() handlers to all dropbox sync actions to prevent stuck loading state
- Add DROPBOX_MATERIALIZER_API_SCOPES (read/write) to .env.example and SCOPES
- Blank out DROPBOX_MATERIALIZER_API_BASE_URL default to keep feature opt-in
- Move getBaseUrl()/summitId guards before getAccessTokenSafely() to avoid unnecessary auth calls
- Use persisted venue name (props) instead of mutable form state in handleRoomResync
- Blacklist dropboxSyncState from redux-persist to prevent stale config across reloads
- Fix "location based" → "location-based" hyphenation in en.json
- Add action tests (10) and reducer tests (6) covering happy path, error path, and early returns

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: use /api/v1/ URL prefix for dropbox-materializer endpoints

Match the canonical URL prefix introduced in dropbox-materializer PR #13
(fix/api-url-versioning). All four endpoints updated from /api/sync/
to /api/v1/sync/.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
smarcet pushed a commit that referenced this pull request Mar 26, 2026
* feat: Add Dropbox sync controls — toggle, Rebuild All, Resync Room (#86b8tx6pv)

Show Admin UI for Track 3 of the dropbox-materializer integration:
- Sync toggle (react-switch) + Rebuild button on Location List page
- Per-room resync icon in Rooms table Actions column (uicore custom action)
- Redux actions/reducer hitting materializer API directly (OAuth2 via uicore)
- Feature-flagged on DROPBOX_MATERIALIZER_API_BASE_URL env var

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: address PR 833 review — error handling, scopes, tests, and misc fixes

- Add .catch() handlers to all dropbox sync actions to prevent stuck loading state
- Add DROPBOX_MATERIALIZER_API_SCOPES (read/write) to .env.example and SCOPES
- Blank out DROPBOX_MATERIALIZER_API_BASE_URL default to keep feature opt-in
- Move getBaseUrl()/summitId guards before getAccessTokenSafely() to avoid unnecessary auth calls
- Use persisted venue name (props) instead of mutable form state in handleRoomResync
- Blacklist dropboxSyncState from redux-persist to prevent stale config across reloads
- Fix "location based" → "location-based" hyphenation in en.json
- Add action tests (10) and reducer tests (6) covering happy path, error path, and early returns

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: use /api/v1/ URL prefix for dropbox-materializer endpoints

Match the canonical URL prefix introduced in dropbox-materializer PR #13
(fix/api-url-versioning). All four endpoints updated from /api/sync/
to /api/v1/sync/.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
smarcet pushed a commit that referenced this pull request May 7, 2026
* feat: add validateAllowedEmailDomainEntry helper for domain-authorized promo codes

* feat: extend DEFAULT_ENTITY with domain-authorized promo code fields

* feat: add i18n strings for domain-authorized promo codes and WithPromoCode audience

* fix: tighten email-domain validation and guard allowed_email_domains null coercion

* feat: add DomainAuthorizedBasePCForm fragment with domain/per-account/auto-apply fields

* fix: pass checked on synthesized auto_apply event so parent reducer reads the boolean

* refactor(task-4): unify auto_apply wrapper through fireChange; add untoggle test

Direct wiring of onChange={handleChange} fails under React 16 event pooling
— target is nullified before test assertions read it. Both quantity and
auto_apply wrappers now synthesize plain objects through a single fireChange
helper (accepts `extra` spread for checkbox's `checked` field). Adds negated
auto_apply test to cover the false→true→false round-trip (6 tests total).

* fix(domain-authorized-promo-codes): use {tag} shape for TagInput value

TagInput maps entries via .tag/.id internally; passing {value,label}
caused undefined.toLowerCase() crash on sort when editing an existing
code with pre-populated allowed_email_domains.

- domainsAsTags: { tag: d } instead of { value: d, label: d }
- normalizeTagValues: extract .tag first, then .value/.label fallback
- filter out empty strings (invalid domain guard)
- add regression test for non-empty initial domains

* feat: export DomainAuthorizedPCForm and DomainAuthorizedDiscountPCForm composites

* feat: render domain-authorized promo code forms and validate domains on save

* feat: add auto_apply checkbox to member promo code forms

* feat: add auto_apply checkbox to speaker promo code forms

* feat: add WithPromoCode audience option to ticket type editor

* feat: include WithPromoCode in ticket-type list page audience filter

* feat: include allowed_email_domains in getPromocode expand

* test: cover class switching and auto_apply visibility in PromocodeForm

* fix: derive apply_to_all_tix for DOMAIN_AUTHORIZED_DISCOUNT_CODE on load

The RECEIVE_PROMOCODE reducer derives the UI-only apply_to_all_tix flag
from ticket_types_rules.length for every class that DiscountBasePCForm
can render, because summit-api's discount-code serializer never returns
apply_to_all_tix. DOMAIN_AUTHORIZED_DISCOUNT_CODE was missing from the
list, so reloading a saved per-ticket domain-authorized discount code
inherited DEFAULT_ENTITY.apply_to_all_tix=true and rendered the
all-ticket Amount/Rate inputs instead of the per-ticket rules table.

Surfaced by Codex second-model review against
sds/promo-codes-for-early-registration-access-summit-admin.md Truth #3
and #13 (discount variant composes DiscountBasePCForm; existing flows
unchanged).

Adds reducer tests covering rules populated, rules empty, and the
access-only DOMAIN_AUTHORIZED_PROMO_CODE variant (which is not a
discount class and must not participate in the derivation).

* feat(i18n): add captions for domain-authorized promo code fields

* refactor: extract domain-authorized fireChange and class-name helper

* test: assert handleChange call count in fireChange checkbox case

Symmetry with the text-default test above; reviewer suggestion.

* feat: add AllowedEmailDomainsRow leaf for domain-authorized layout

* test: assert AllowedEmailDomainsRow renders chips from saved domains

* feat: add AutoApplyCheckbox leaf for domain-authorized layout

* feat: add MaxPerAccountInput leaf for domain-authorized layout

* refactor: reflow domain-authorized fields to leaves and host conditionals

* test: extend integration test infra with screen import and renderForm extraProps

* test: assert DOMAIN_AUTHORIZED leaf positions in promocode form layout

* test: cover validate() drift between helper and domain enforcement

Adds three integration tests observing the onSubmit mock to confirm
validate()-driven save blocking for domain-authorized promo codes.
Also polyfills scrollIntoView on HTMLElement.prototype (jsdom gap) and
re-adds the screen import (used by the new getByRole calls).

* test: regression matrix for 12 non-DomainAuthorized classes

Append two it.each blocks covering MEMBER/SPEAKER (assert #auto_apply
present) and SPONSOR/SUMMIT/PRE_PAID/SPEAKERS (assert no #auto_apply),
confirming none render the DomainAuthorized layout reflow fields.
Also add speakers fixture to baseEntity so SPEAKERS_* classes mount
without crashing on entity.speakers destructuring.

* docs: correct line-number citation in regression matrix routing comment

Sponsor branch ends at :478; SummitPCForm + PRE_PAID_PROMO_CODE branch
is :494-505; SummitDiscountPCForm + PRE_PAID_DISCOUNT_CODE is :507-518.
The original :480-504 range straddled two branches.

* fix(promocode): surface validate() errors in DA row + normalize legacy null fields

- Pass hasErrors through to AllowedEmailDomainsRow so validate()-path
  rejections render inline (was silently blocking save). Local onCreate
  error preserved as fallback.
- Call scrollToError from validate() with a single-key object so the
  scroll targets the offending field (state.errors accumulates empty
  keys for every edited field; scrollToError uses Object.keys()[0]).
- Coerce auto_apply (boolean) and quantity_per_account (number) after
  the null->"" reducer loop so legacy promocodes don't round-trip
  mixed-typed payloads to summit-api.

Addresses smarcet review on PR #915.

* fix(promocode): apply santipalenque + smarcet PR #915 reviews

santipalenque:
- Extract auto_apply checkbox to forms/auto-apply-checkbox.jsx with
  optional withCaption / marginTop props. Member and speaker fragments
  now consume the shared component instead of duplicating the inline
  abc-checkbox block. Domain-authorized leaf usage hoists out of
  forms/domain-authorized/ since the trait participates in member/
  speaker fragments too.
- Replace openstack-uicore-foundation TagInput in AllowedEmailDomainsRow
  with a freeform <input> + chip array. The foundation TagInput wraps
  react-select AsyncCreatable and fires queryTags against
  /api/v1/.../allowed-tags on every keystroke; email domains have
  nothing to do with the Tags table. Commit on Enter / comma / blur;
  Backspace on empty draft removes last chip; per-chip x button.

smarcet:
- Tighten ALLOWED_DOMAIN_RE and ALLOWED_EMAIL_RE in src/utils/methods.js
  to RFC-1035-style labels: each label must start and end with [a-z0-9],
  internal hyphens allowed. Rejects underscores and leading/trailing
  hyphens (e.g. @acme_corp.com, @acme-.com). Note: server's
  AllowedEmailDomainsArray.php uses [\w.-] which accepts these — the
  client is now intentionally stricter than the server. Server-side
  alignment is a separate summit-api PR if desired.

Codex second-model review (claim 3, verified):
- AllowedEmailDomainsRow input onChange now mirrors handleChange:114
  semantics: when a parent state.errors[id] is present (validate-path
  failure), typing fires a no-op fireChange with the unchanged domains
  array so the parent reset clears the .text-danger banner on the
  first keystroke, not only on commit/remove. Bypassed on the happy
  path to avoid wasted re-renders.

Test coverage:
- 11 new invalid cases for the regex (underscores, leading/trailing
  hyphens at every position).
- 6 cases for the shared AutoApplyCheckbox covering caption + margin
  variants.
- 14 cases for the rewritten AllowedEmailDomainsRow driving the bare
  input directly (no TagInput mock); plus 2 regression tests for the
  parent-error-clear-on-typing contract.
- Integration test addDomain helper updated; new regression test for
  the .text-danger banner clearing on plain typing.

Test suite: 543/543 passing (was 526/526).
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