Skip to content

fix: sync third-party binding state in personal settings - #1916

Merged
seefs001 merged 1 commit into
QuantumNous:mainfrom
RedwindA:fix/3rd-binding-state
Sep 29, 2025
Merged

fix: sync third-party binding state in personal settings#1916
seefs001 merged 1 commit into
QuantumNous:mainfrom
RedwindA:fix/3rd-binding-state

Conversation

@RedwindA

@RedwindA RedwindA commented Sep 29, 2025

Copy link
Copy Markdown
Contributor

PR 类型

  • Bug 修复
  • 新功能
  • 文档更新
  • 其他

PR 是否包含破坏性更新?

PR 描述

close #1914
修复个人设置页面中第三方绑定状态显示不一致的问题。后端接口 /api/user/self 现在会返回各第三方账号的绑定 ID,前端在刷新用户信息时会同步写入 localStorage,确保绑定状态与实际一致。

效果

  • Before
图片
  • After
图片

@coderabbitai

coderabbitai Bot commented Sep 29, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

Backend adds four ID fields to the GetSelf user response. Frontend PersonalSetting now imports and invokes setUserData after fetching current user data, in addition to dispatching the login action. No other control-flow or error handling changes are indicated.

Changes

Cohort / File(s) Summary
Backend: GetSelf response fields
controller/user.go
Extends returned user object with github_id, oidc_id, wechat_id, telegram_id mapped from user.GitHubId, user.OidcId, user.WeChatId, user.TelegramId. No other logic changes.
Frontend: Personal settings state sync
web/src/components/settings/PersonalSetting.jsx, web/src/helpers/*
After fetching current user, continues to dispatch login and now also calls setUserData(data); imports setUserData from helpers. Public export setUserData added in web/src/helpers.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant UI as PersonalSetting.jsx
  participant API as /api/user/self
  participant Store as Redux Store
  participant Helpers as helpers.setUserData

  User->>UI: Open Personal Settings
  UI->>API: GET current user
  API-->>UI: 200 OK + user { github_id, oidc_id, wechat_id, telegram_id, ... }
  UI->>Store: dispatch(login(user))
  UI->>Helpers: setUserData(user)
  note right of UI: No changes to error handling/control flow otherwise
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested reviewers

  • seefs001

Poem

I nibble through commits with whiskers keen,
Four shy IDs now join the scene.
Frontend pockets the data, snug and bright,
setUserData tucks it in just right.
Thump-thump! says the reviewer’s chair—
Small hops forward, code made fair. 🐇✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The title clearly summarizes the primary change by indicating a fix to sync third-party binding state in the personal settings UI, which aligns with the PR’s objective of ensuring binding status consistency.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@seefs001
seefs001 merged commit 4bb4b64 into QuantumNous:main Sep 29, 2025
1 check passed
x22x22 pushed a commit to x22x22/new-api that referenced this pull request Apr 24, 2026
fix: sync third-party binding state in personal settings
@RedwindA
RedwindA deleted the fix/3rd-binding-state branch July 23, 2026 07:04
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.

TG绑定按钮状态显示错误

2 participants