fix: custom oauth binding status never shown due to id type mismatch - #6573
Open
feitianbubu wants to merge 1 commit into
Open
fix: custom oauth binding status never shown due to id type mismatch#6573feitianbubu wants to merge 1 commit into
feitianbubu wants to merge 1 commit into
Conversation
Contributor
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 |
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.
个人资料页「账户绑定」里,自定义 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