Skip to content

fix(user): don't reject an unspecified language on admin user creation - #21

Merged
kigiela merged 1 commit into
mainfrom
fix/admin-create-user-empty-language
Jul 20, 2026
Merged

fix(user): don't reject an unspecified language on admin user creation#21
kigiela merged 1 commit into
mainfrom
fix/admin-create-user-empty-language

Conversation

@kigiela

@kigiela kigiela commented Jul 20, 2026

Copy link
Copy Markdown

Why

The /users admin page's Create User form has no language field, so every request from it hits the shared language govalidator tag with an empty string - which treated empty as invalid, failing the whole request with a generic "invalid data" error before it ever reached the create logic. Reproduced live just now trying to create an account for a new hire.

What

The language tag now treats an empty string as "not specified" (valid) instead of a validation failure. Non-empty values are still checked against the registered translations exactly as before. Matches how user creation already behaves elsewhere - the CLI's user create command never sets a language either.

Verification

Added TestLanguageValidatorAllowsEmptyString; go test ./pkg/user/... passes.

The docsales-admin create-user form (PR #14/#15) has no language field,
so CreateUserBody.Language is always sent empty - and the shared
"language" govalidator tag treated empty as invalid, rejecting every
request from that form with a generic "invalid data" error.

Treat an empty language as "not specified" (valid, left as-is) instead
of a validation failure. Non-empty values are still checked against the
registered translations exactly as before - this only affects callers
that omit the field entirely, matching how user creation already
behaves elsewhere (e.g. the CLI's `user create` command never sets a
language either).
@github-actions

Copy link
Copy Markdown

Preview Deployment

Preview deployments for this PR are available at:

URL Tag Commit
https://pr-21.preview.vikunja.dev ghcr.io/docsales/vikunja:pr-21 latest
https://sha-d0adbc6df75bc4384c717b7a36e8b18196429703.preview.vikunja.dev ghcr.io/docsales/vikunja:sha-d0adbc6df75bc4384c717b7a36e8b18196429703 d0adbc6

The preview environment will start automatically on first visit. Subsequent pushes to this PR will update the pr-21 image — the preview picks up the new version on restart. The per-commit URLs point to a specific version and will not change.

Run locally with Docker
docker pull ghcr.io/docsales/vikunja:pr-21
docker run -p 3456:3456 ghcr.io/docsales/vikunja:pr-21

Last updated for commit d0adbc6

@kigiela
kigiela merged commit 414bec4 into main Jul 20, 2026
44 checks passed
@kigiela
kigiela deleted the fix/admin-create-user-empty-language branch July 20, 2026 18:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant