fix(profile): send locale wire key on profile update (was language)#81
Open
anilcancakir wants to merge 2 commits into
Open
fix(profile): send locale wire key on profile update (was language)#81anilcancakir wants to merge 2 commits into
anilcancakir wants to merge 2 commits into
Conversation
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.
There was a problem hiding this comment.
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
languageparameter under thelocalewire key. - Added/updated tests to assert
localeis sent (andlanguageis 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 Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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.
What
MagicStarterProfileController.doUpdateProfileposted the request body fieldlanguage, but the backendUpdateProfileRequestvalidateslocale(the canonical field: server column,RegisterRequest, and config all uselocale). So a profile language change was silently dropped and never persisted.Fix
Map the (unchanged) Dart
languageparameter to thelocalewire key. No backwards-compat alias left behind.Tests
PUT /user/profilebody carrieslocaleand nolanguage.preferences_views_test.dartthat hard-coded the buggylanguagewire key (its own title already read "submits the locale").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.