🐛 fix(auth): make the terms flow work against a real instance - #52
Merged
Conversation
Fetching the terms from a live instance failed with "couldn't read the server's response". planka-openapi.json lists `type` under the terms item's `required` keys; pro.demo.planka.cloud does not send it at all, and a non-optional `type` failed the whole decode. Also split the terms text at PLANKA's `[confirmations]::` marker. The statements after it are what the user is agreeing to, so they belong beside the accept button — left in the body they render as a literal `[confirmations]::` line in the middle of the terms. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Asking `GET /terms` for a language an instance does not have is not a no-op and does not fall back to English: a de-DE/en-US instance answers a request for fr-FR with German. Passing the device language straight through therefore showed a French user legal terms in a language they may not read. Read `Bootstrap.termsLanguages` first and choose from what the instance actually offers — the user's language, then any regional variant of it, then English, and only then whatever the instance happens to list first. Checked against both editions' demo instances: Community 2.2.1 and Pro 2.4.1 serve the same terms payload (no `type`, same `[confirmations]::` marker), so this holds for both. Their bootstraps differ a lot more — Pro returns branding, maintenance and OIDC fields Community omits entirely — but every one of those is already optional in `Bootstrap`, so both decode. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
Follow-up to #51, which shipped before these two were found. The terms screen as merged cannot load terms from any real instance — it fails with "couldn't read the server's response".
1. The terms payload has no
typeplanka-openapi.jsonliststypeunder the terms item'srequiredkeys. Neither demo instance sends it:{"item":{"language":"en-US","content":"# ⚠️ THIS IS ONLY A TEMPLATE…","signature":"2796eed…"}}Declaring it non-optional failed the whole decode. It is now optional, with a regression test built from the observed response.
Also splits the body at PLANKA's
[confirmations]::marker. The statements after it are what the user is agreeing to, so they belong beside the accept button — left in place the marker renders as a literal line in the middle of the terms.2. An unavailable language does not fall back to English
Asking
GET /termsfor a language an instance does not have returns whichever it lists first, not English. Verified against a de-DE/en-US instance:Passing the device language straight through would have asked a French user to accept legal terms in German.
Bootstrap.termsLanguagesis now read first and the choice made client-side: the user's language, then a regional variant, then English, and only then the instance's first.Community vs Pro
Both editions' demo instances were checked, since the two can drift:
GET /termspayloadtype, same[confirmations]::markerbootstrapfieldstermsLanguages,version,isDemoModeoidcThe bootstrap difference is already safe: every field except
versionis optional inBootstrap, so Community's leaner payload decodes.oidcbeing absent there matches SSO being a Pro feature.Not verified: the login
POSTon a Community instance.curlis unavailable in this environment and WebFetch only does GET, so whether Community's 403 carries the samependingToken/stepis unconfirmed — the GET-side payloads being byte-identical makes it likely but not certain.Verification
176 tests (8 new), app builds, lint clean, localization guard passes.
🤖 Generated with Claude Code