Repository navigation
fix(web): scope email template languages to active languages - #1810
Merged
Merged
Conversation
gdevenyi
requested changes
Oct 14, 2026
gdevenyi
left a comment
Contributor
There was a problem hiding this comment.
The lint-and-test check fails, so review is on hold.
@opendatacapture/web#lint stops at tsc. The new required activeLanguages prop is not passed in the existing unit tests:
apps/web/src/components/GroupEmailTemplates/__tests__/EditTemplateDialog.test.tsx(line 35)apps/web/src/components/GroupEmailTemplates/__tests__/ViewDefaultTemplateDialog.test.tsx(lines 18, 23, 33, 40)
Please pass activeLanguages in these tests, run pnpm lint and pnpm test:coverage locally, and push. Review continues when CI is green.
Reviewed at commit a338e3b.
joshunrau
requested changes
Oct 25, 2026
joshunrau
left a comment
Collaborator
There was a problem hiding this comment.
Thanks for this. Scoping the template editors to the active languages is the right fix. A few things before it can go in:
- The send pickers still offer disabled languages, and one now offers Spanish for the first time. The built-in assignment template now includes Spanish, so the "send by email" language picker in
AssignmentEmailForm.tsx(lines 58-62) offers Spanish even when Spanish is disabled. Before this PR it only offered English and French. Please intersect its options withsetupStateQuery.data.activeLanguages, and handle a template authored only in disabled languages. Please also passoptions={setupStateQuery.data.activeLanguages}to the welcome-email picker inroutes/_app/admin/users/create.tsx:132. Otherwise an admin can send the welcome email in a language whose template the mail page no longer shows. Add a unit test for each. - The tests don't catch the scoping being removed. I removed
languages={activeLanguages}from the create, edit and new-user editors and put the new-user validation back to every language, and all 29 tests in those three files still passed.NewUserTemplateSection.test.tsx:102passes either way, because the component fills Spanish and French from the defaults. Its description also says "English and French" but it passes['en']. Blank an inactive language (es: '') withactiveLanguages: ['en', 'fr']so it fails without the change.EditTemplateDialog.test.tsx:20says a test there tells a scoped picker from an unscoped one, but there isn't one yet. Please add the picker assertion fromViewDefaultTemplateDialog.test.tsx:50there, and inCreateTemplateForm.test.tsxandNewUserTemplateSection.test.tsx.
- Stale comment:
NewUserTemplateSection.tsx:40-41still says every language must be filled in. It's every active language now. - The settings sort needs a test. Nothing in
routes/_app/admin/__tests__/settings.test.tsxchecks the checkbox order. In English the sorted order (English, French, Spanish) differs from theLANGUAGESorder, so one assertion is enough. - E2E test. Every change needs one in
testing/. The e2e instance is seeded with English and French only, so you can assert that the template-editor and send-form pickers don't offer Spanish. You'll need*-languagelocators intesting/src/pages/_app/group/email-templates.page.tsandtesting/src/pages/_app/admin/mail.page.ts.admin-settings.spec.ts:100turns Spanish on temporarily and Playwright runs in parallel locally, so put the assertion in that file's serialactive languagesblock to keep it stable. - Commit history. PRs are merged with their commits intact and the changelog gets one entry per commit. Please split
a338e3binto separately scoped commits, e.g.:fix(schemas): add Spanish to the default email templates. This changes what the API sends, so it deserves its own changelog entry.fix(web): scope email template languages to active languages, with the test fix froma1c3c0efolded in so every commit passestsc.- A separate commit for the settings sort.
If you hand this to Claude Code, Opus 5 is the right size. The work spans components, a route, unit tests and the Playwright suite, and item 1 needs a judgment call on the fallback.
Reviewed at commit a1c3c0e.
This was referenced Oct 26, 2026
The built-in welcome and assignment templates were authored in English and French only, so an instance offering Spanish sent either in a language the recipient had not asked for.
The template editors offered every language the application ships, so an admin could author copy in one the instance had disabled and nothing would ever send it. The welcome template's validation likewise demanded a language no reader is offered. Both now follow the instance's active languages.
The assignment and welcome email pickers chose from every language the application ships. With Spanish now in the built-in assignment template, the assignment picker offered it even where the instance had disabled it. A template authored only in disabled languages keeps its own, since its copy exists nowhere else and scoping it away would leave it unsendable.
The list followed the canonical language order, which reads as arbitrary to anyone scanning it for a language.
thomasbeaudry
force-pushed
the
fix/email-template-languages
branch
from
October 26, 2026 20:47
a1c3c0e to
77d3f18
Compare
joshunrau
approved these changes
Oct 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
An instance can disable a language, but the email surfaces ignored that: the template editors
offered every language the application ships, and the send pickers chose from the same list. An
admin could author copy in a language nothing would ever send, and the welcome template's
validation demanded a language no reader is offered.
Four commits, scoped so the changelog reads one entry each:
fix(schemas)— Spanish added to both built-in templates (welcome and assignment). This changeswhat the API sends.
fix(web)— the template editors and the welcome template's validation follow the instance'sactive languages.
fix(web)— the assignment and welcome send pickers do the same. A template authored only indisabled languages keeps its own: the copy exists nowhere else, so scoping it away would leave
the template unsendable.
fix(web)— the active-language checkboxes on the settings page are listed by their translatedname rather than the canonical language order.
Review notes
One deviation from the review's suggestion for the e2e placement. The new-user template editor is
behind
isMailEnabled, andmail.spec.tsdocuments that it owns that flag for the whole suite, sothat assertion lives there rather than in
admin-settings.spec.ts. To keep it stable against theSpanish toggling in
admin-settings.spec.ts, it asserts the picker offers no language outside theset returned by a new
ApiClient.findActiveLanguages(), read in the same test — a subset checkrather than an exact list. The group-editor and checkbox-order assertions are in
admin-settings.spec.tsas suggested, the former inside the serialactive languagesblock.Test plan
pnpm lint— 34/34 taskspnpm test:coverage— 412 files, 4732 tests, 100% statements/branches/functions/linespnpm test:e2e— 293 passed. Two unrelated failures locally:record-file-deletion(local
.envhasSTORAGE_ENABLED=false; CI generates from.env.template, which has iton) and
subject-detail, which timed out under full parallel load and passes on its own.without the change.
tscrun againstapps/web,packages/schemasandtestingat each of the four commits.🤖 Generated with Claude Code