Skip to content

fix(#544): fold translation purpose into residents speak; make all fields optional#545

Merged
need4deed merged 2 commits into
developfrom
fix/544-opportunity-details-translation-purpose-dedupe-optional
May 20, 2026
Merged

fix(#544): fold translation purpose into residents speak; make all fields optional#545
need4deed merged 2 commits into
developfrom
fix/544-opportunity-details-translation-purpose-dedupe-optional

Conversation

@nadavosa
Copy link
Copy Markdown
Collaborator

Closes #544

Changes

formatters.ts

  • formatLanguagesByPurpose now accepts LangPurpose | LangPurpose[] and dedupes by id — single-purpose callers are unaffected

OpportunityDetailsDisplay.tsx

  • Residents speak now aggregates RECIPIENT + TRANSLATION languages, deduped by id

OpportunityDetailsEdit.tsx

  • Residents speak default values seeded from RECIPIENT + TRANSLATION languages, deduped by id
  • On save, sent as languagesResidents → BE (parser-opportunity-patch-data.ts) stores all as TRANSLATION per API contract (confirmed via source)
  • Save button: disabled={!isValid} only — !isDirty guard removed

opportunityDetailsSchema.ts

  • Dropped: description.min(1), numberOfVolunteers required refine, languagesValidator "at least one" check, activities.min(1)
  • Kept: description.max(MAX_DESCRIPTION_LENGTH) (real validation failure, not a required check)

API contract note (re: Arturas' comment)

parseOpportunity in BE maps languagesResidents → LangPurpose.TRANSLATION. After the first save through this UI, any legacy RECIPIENT-purpose languages will be persisted as TRANSLATION. The display/edit aggregation is the same either way.

nadavosa and others added 2 commits May 20, 2026 12:54
…elds optional

- formatLanguagesByPurpose now accepts LangPurpose | LangPurpose[] and dedupes by id
- OpportunityDetailsDisplay: residents speak aggregates RECIPIENT + TRANSLATION (deduped)
- OpportunityDetailsEdit: seed residents speak from RECIPIENT + TRANSLATION (deduped);
  on save, sent as languagesResidents → BE stores all as TRANSLATION per API contract
- Save button: disabled={!isValid} only — empty fields no longer block saving
- opportunityDetailsSchema: dropped description.min(1), numberOfVolunteers refine,
  languagesValidator required check, activities.min(1); kept description.max only

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…s typecheck

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@need4deed need4deed merged commit f5c4a94 into develop May 20, 2026
1 check passed
@need4deed need4deed deleted the fix/544-opportunity-details-translation-purpose-dedupe-optional branch May 20, 2026 12:23
@nadavosa nadavosa restored the fix/544-opportunity-details-translation-purpose-dedupe-optional branch May 21, 2026 09:37
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.

Opportunity details: fold translation into Main communication (deduped); make all fields optional

2 participants