Skip to content

fix(profile): send locale wire key on profile update (was language)#81

Open
anilcancakir wants to merge 2 commits into
mainfrom
fix/profile-locale-wire-key
Open

fix(profile): send locale wire key on profile update (was language)#81
anilcancakir wants to merge 2 commits into
mainfrom
fix/profile-locale-wire-key

Conversation

@anilcancakir

Copy link
Copy Markdown
Contributor

What

MagicStarterProfileController.doUpdateProfile posted the request body field language, but the backend UpdateProfileRequest validates locale (the canonical field: server column, RegisterRequest, and config all use locale). So a profile language change was silently dropped and never persisted.

Fix

Map the (unchanged) Dart language parameter to the locale wire key. No backwards-compat alias left behind.

Tests

  • New controller test asserts the PUT /user/profile body carries locale and no language.
  • Corrected a stale assertion in preferences_views_test.dart that hard-coded the buggy language wire key (its own title already read "submits the locale").
  • Full suite green (1160 tests).

Context

Found and fixed while wiring end-to-end TR/EN localization in the uptizm app (the client sets the language via this path). Isolated here as its own PR off main.

doUpdateProfile posted the body field 'language', but the backend UpdateProfileRequest validates 'locale', so a profile language change silently failed to persist. Map the (unchanged) Dart parameter to the 'locale' wire key. Covered by a new controller test asserting the request body carries 'locale' and no 'language', plus a corrected preferences-view assertion.
Copilot AI review requested due to automatic review settings July 21, 2026 12:03

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes a backend contract mismatch in MagicStarterProfileController.doUpdateProfile: the controller previously sent the selected language under the language request-body key, but the backend expects locale, causing profile language/locale updates to be silently ignored.

Changes:

  • Updated the profile update payload to send the Dart language parameter under the locale wire key.
  • Added/updated tests to assert locale is sent (and language is not).
  • Documented the fix in CHANGELOG.md.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
lib/src/http/controllers/magic_starter_profile_controller.dart Sends language under the locale request key when updating the profile.
test/http/controllers/magic_starter_profile_controller_test.dart Adds a controller-level regression test for locale vs language payload keys.
test/ui/views/preferences/preferences_views_test.dart Updates widget test assertion to expect locale in the outgoing /user/profile payload.
CHANGELOG.md Records the bugfix and its impact for release notes.

@codecov

codecov Bot commented Jul 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

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.

2 participants