Conversation
There was a problem hiding this comment.
Thanks for the fix! The core logic change (checking only the 4 required fields instead of all response keys) is correct and solves the immediate bug.
A few observations:
1. Root cause is on the backend
The real issue is that GET /api/user/privacy returns the raw pricacy_setting JSON column (server/app/controller/user/user_controller.py:80), which leaks any extra key ever written to it. If the backend filtered through UserPrivacySettings:
return UserPrivacySettings(**model.pricacy_setting).model_dump()then unknown fields like help_improve would be stripped at the source, and the original frontend code would work fine. Worth considering a backend-side fix too — the frontend fix alone means any future field added to the stored JSON could re-introduce this bug.
2. Hardcoded field list is fragile
If the UserPrivacySettings model gains a new required field later, someone needs to remember to update this frontend list too. Consider either:
- Fixing on the backend (preferred, see above)
- Or at minimum, adding a comment linking to the backend model so future devs know to keep them in sync
3. Tailwind class reordering adds review noise
The diff has ~15 lines of pure Tailwind class reordering (alphabetizing). While cosmetically fine, mixing formatting changes with a bug fix makes the PR harder to review and increases merge conflict risk with other open branches. Ideally these would be in a separate commit or PR.
Overall the approach is sound — just needs the formatting noise separated and testing evidence added. The backend-side fix would be the more robust long-term solution.
Co-authored-by: a7m-1st <Ahmed.jimi.awelkeir500@gmail.com>
Related Issue
Closes #1454
Description
Testing Evidence (REQUIRED)
What is the purpose of this pull request?
Contribution Guidelines Acknowledgement