Skip to content

fix: 用户仅加入成员组时用户中心「所属项目」不显示该项目 - #672

Merged
iwanghc merged 2 commits into
mainfrom
dms/feat-980
Aug 26, 2026
Merged

fix: 用户仅加入成员组时用户中心「所属项目」不显示该项目#672
iwanghc merged 2 commits into
mainfrom
dms/feat-980

Conversation

@LordofAvernus

@LordofAvernusLordofAvernus commented Aug 26, 2026

Copy link
Copy Markdown
Collaborator

User description

关联的 issue

https://github.com/actiontech/dms-ee/issues/980

描述你的变更

  • ListUsers 批量 UNION 查询(直接成员 ∪ 成员组),覆盖回填 projects,语义与 GetUserProject 一致,避免 N+1
  • convertModelUser 对直接成员项目名去重,列表最终真相源为 ListUsers 批量回填

确认项(pr提交后操作)

Tip

请在指定复审人之前,确认并完成以下事项,完成后✅


  • 我已完成自测
  • 我已记录完整日志方便进行诊断
  • 我已在关联的issue里补充了实现方案
  • 我已在关联的issue里补充了测试影响面
  • 我已确认了变更的兼容性,如果不兼容则在issue里标记 not_compatible
  • 我已确认了是否要更新文档,如果要更新则在issue里标记 need_update_doc

Made with Cursor


Description

  • 修复用户项目名称重复问题

  • 批量查询填充用户项目

  • 新增 UNION 查询避免 N+1


Diagram Walkthrough

flowchart LR
A["\"convertModelUser 去重处理\""]
B["\"ListUsers 收集用户UID\""]
C["\"listProjectNamesByUserUIDs 批量查询\""]
D["\"ListUsers 填充用户项目\""]
A -- "确保项目名称唯一" --> B
B -- "传递UID列表" --> C
C -- "返回项目映射" --> D
Loading

File Walkthrough

Relevant files
Bug fix
convert.go
用户转换时项目去重处理

internal/dms/storage/convert.go

  • 添加 seenProjects map 去重
  • 检查并跳过重复项目名称
+7/-1
user.go
批量填充用户项目及查询优化

internal/dms/storage/user.go

  • 批量收集用户UID并查询项目
  • 引入 listProjectNamesByUserUIDs 方法
  • 使用 UNION 查询合并直接成员与成员组项目
+73/-0

LordofAvernusand others added 2 commits August 26, 2026 12:27
Preserve Members→projects initial value for other callers; dedupe by
project name defensively before ListUsers batch overwrite.
Fixesactiontech/dms-ee#980
Co-authored-by: Cursor <cursoragent@cursor.com>
Batch UNION query (members ∪ member_group_users) fills projects per page
without N+1 GetUserProject calls; semantics match GetUserProject.
Fixesactiontech/dms-ee#980
Co-authored-by: Cursor <cursoragent@cursor.com>
@github-actions

Copy link
Copy Markdown

PR Reviewer Guide 🔍

⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ No major issues detected

@github-actions

Copy link
Copy Markdown

Failed to generate code suggestions for PR

@iwanghc
iwanghc merged commit cf4c5e9 into mainAug 26, 2026
1 check passed
Sign up for freeto 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.

2 participants

@LordofAvernus@iwanghc