fix: score yes/no answers, translate options, scope forms list#191
Merged
Conversation
- yes_no with an explicit "No" (false) is now a valid answer for required fields via a field-aware isAnswerMissing helper, instead of false being treated as blank (which only holds for consent/age_check checkboxes) - translate the Yes/No radio labels via the form dictionary in all 7 locales instead of hardcoded English - scope the dashboard forms list to the viewer's review scope so a per-form reviewer no longer sees or exports every form in the guild Also bump packageManager to pnpm@11.10.0 and update author contact.
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.
Three customer-reported bugs.
1. Required yes/no not submittable when "No" is selected
yes_nois a boolean field, so picking "No" producesfalse.isBlankAnswer(false)returnedtrue, so a required yes/no with "No" read as missing and blocked submission with "This field is required." Thefalse-is-blank rule is only correct for consent/age_check checkboxes.Fix: a field-aware
isAnswerMissing(field, value)helper in shared. Foryes_no, bothtrueandfalseare valid answers; consent/age_check keep their "unchecked box = no agreement" semantics. Both the server schema (buildAnswerSchema) and the client renderer now use it.2. Yes/No options not translated
The radio labels "Yes"/"No" were hardcoded. Added
yes/noto theformdictionary section in all 7 locales and plumbed them throughFormLabelsintoFieldInput.3. Per-form viewer sees and exports every form
The export route was already per-form gated, but the dashboard forms list ran unscoped (
getGuildForms(guildId)), so a viewer granted a single form still saw all forms, their submission counts, slugs and export buttons.Fix:
getGuildForms(guildId, scope)filters by review scope. Managers and guild-wide reviewers still see everything; a per-form reviewer sees only their granted forms, consistent with the existing submissions/board scoping.Tests: added shared cases for yes_no ("No" accepted) and consent (unchecked rejected). Typecheck, lint, tests (85) and build all green.