Repository navigation
fix: restore language setup, term writes and starter words - #333
Merged
Merged
Conversation
New users could not set up a language, and on multi-user installs nobody could change a term's status or save a term edit. - The language wizard wrote to the DOM without telling Alpine, so Save saw an empty form. Retyping the name stored the language with no dictionary, language codes, parsing rules or parser. The wizard now reports every field, applies the preset's parser, and fills in the translator URL and target language, which it never did. - setWordStatus() and updateTermFull() ran a user-scoped query with a new literal list, dropping the user ID that scoping appends: HTTP 500 in multi-user mode only. A source test now rejects that shape. - Starter words were inserted with WoWordCount 0 and never linked, so the reader treated them as unknown. The import counts and links them, and a migration repairs earlier imports. - The e2e test retyped the wizard's name before saving, which hid the first bug. It now saves what the wizard filled in.
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.
Found by testing 3.8.0 on production with real data. On lwt-online.org, a new user could not set up a language properly, and nobody could change a term's status or save a term edit.
Fixes
language.form.name_required. Retyping the name stored the language with no dictionary, language codes, parsing rules or parser. The wizard now reports every field and applies the preset's parser. It also fills in the translator URL (window.GGTRANSLATEwas never assigned) and the target language when the native language is preselected. The error now uses a key that exists.setWordStatus()andupdateTermFull()scoped a query with$bindings, then ran it with a new literal list. That dropped the user ID, so both returned HTTP 500 in multi-user mode and worked in single-user mode.WoWordCount0 and never linked, so the reader treated them as unknown. The import now counts and links them. A migration links earlier imports, and the existingcomputeMissingWordCounts()fills in their counts.The linking statement moved from
LocalDictionaryServicetoMaintenance::linkOccurrencesToTerms()so both imports share it. It is recorded inOwnerlessTableWriteTest.Not repaired
Languages already saved without their settings stay that way, because nothing records which settings were lost. The changelog points users to the edit page.
Tests
Each new test fails without its fix:
MultiUserTermWritesIntegrationTestruns as a signed-in user in multi-user mode and reproduces the productionmust consist of exactly 10 elements, 9 presenterror.ScopedBindingsReachTheQueryTestis a source scan, so it also runs in CI without a database.language_wizardVitest cases track whatx-modelwould see.04-languages.cy.tsused to retype the name before saving, which hid the bug. It now saves what the wizard filled in, and without the fix it stays on/languages/new.Psalm, PHPCS on the changed PHP files, PHPUnit, integration tests, Vitest and ESLint pass. Cypress passes except
24-*, the live Anki spec, which needsnpm run anki:upand was not run.The dark-theme and smaller bugs from the same test follow in a separate PR.