fix: guild-language DMs + one active submission per person#178
Merged
Conversation
Two customer-reported issues. 1) Bot DMs ignored the guild's configured language. Applicant status/message DMs were localized to the recipient's own Discord locale, so a guild that set its bot language to (e.g.) Hungarian still saw English/German DMs. DMs now use the guild's botConfig.locale when set (matching the review embeds and activity log), falling back to the applicant's Discord locale, then English. 2) A signed-in applicant could submit the same form repeatedly. New per-form setting "One active submission per person" (default on, toggle in the builder): while the applicant has an open (non-terminal) submission they are redirected to its status page instead of the form, and the submit endpoint rejects a duplicate with 409 + the existing submission id (the renderer then redirects). Once a reviewer sets a terminal status (accepted/rejected/ withdrawn or a custom terminal status) they may apply again. Enforced only for signed-in applicants — anonymous submits can't be tied to a person. - shared: isTerminalStatus() + singleSubmission flag/helper on formSettings - lib/forms: findActiveSubmissionId() - i18n: builder.singleSubmissionLabel/Hint in all 7 locales - tests for isTerminalStatus and singleSubmissionEnforced
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.
Two customer-reported issues.
1. Bot DMs ignored the guild's configured language
Applicant status/message DMs were localized to the recipient's own Discord locale, so a guild that set its bot language to Hungarian still saw applicants receive English/German DMs (screenshots showed a Hungarian form with English and German status DMs).
Fix: applicant DMs now use the guild's
botConfig.localewhen it is set (consistent with the review embeds and activity log), falling back to the applicant's Discord locale, then English. A guild that hasn't picked a language keeps the per-applicant behavior.2. A signed-in applicant could submit the same form repeatedly
New per-form setting "One active submission per person" (default on, toggle in the builder's settings section).
409+ the existing submission id, and the form renderer redirects to the status page.Details
isTerminalStatus()+singleSubmissionflag andsingleSubmissionEnforced()helper on form settings (JSON, no migration; carried through export/import).lib/forms:findActiveSubmissionId().builder.singleSubmissionLabel/singleSubmissionHintin all 7 locales.isTerminalStatusandsingleSubmissionEnforced.Checks
Typecheck, lint, test (shared 83 / web 40 / bot 4), build all green.
Note
Issue 1 only takes effect once the guild has set its bot language (Bot settings page or
/forms language). For the Hungarian server in the screenshots, set the bot language to Hungarian after deploy.