fix: custom oauth binding status never shown due to id type mismatch - #6573
feitianbubu wants to merge 1 commit into
Conversation
WalkthroughCustom OAuth binding types now use numeric provider IDs and ChangesCustom OAuth binding updates
Estimated code review effort: 1 (Trivial) | ~5 minutes Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
本地在
结论:这个修复方向是对的,至少需要让前端对齐后端响应字段,或在比较时统一 |
|
@ 作者 可以加速 :P |
|
51fdfc5 to
2b6f1df
Compare
个人资料页「账户绑定」里,自定义 OAuth 提供商永远显示「未绑定」,即使 user_oauth_bindings 表里有绑定记录。
原因:后端
/api/user/oauth/bindings返回的provider_id是 JSON 数字(Go int),前端却用b.provider_id === String(provider.id)严格比较,数字和字符串永远不相等,所以 isBound 恒为 false。另外前端接口声明的external_id字段后端并不返回(实际字段叫provider_user_id),绑定卡片上也一直显示不出第三方身份 ID。改法:前端类型声明对齐后端响应(
provider_id: number、provider_user_id),按数字直接比较,卡片显示改用provider_user_id。🚀 变更类型 / Type of change
🔗 关联任务 / Related Issue
✅ 提交前检查项 / Checklist
Bug fix,我已提交或关联对应 Issue,且不会将设计取舍、预期不一致或理解偏差直接归类为 bug。📸 运行证明 / Proof of Work
修复前:

修复后:

Summary by CodeRabbit