fix: 优化群成员分页并补齐头像资料

This commit is contained in:
richjohnrambo
2026-09-09 09:38:20 +08:00
parent aae13c9265
commit 9ac2b412cc
7 changed files with 167 additions and 61 deletions
+15 -2
View File
@@ -2904,7 +2904,7 @@ func refreshUserProfileProjections(tenantID types.TenantID, uid types.Uid, profi
items, nextCursor, err := Relations.ListFriends(tenantID, uid, "", "", cursor, 100)
if err != nil {
logs.Warn.Printf("profile %s: refresh friend subscription projections failed: %v", uid, err)
return
break
}
for _, item := range items {
if item.Friendship.Topic == "" || item.Friendship.PeerID.IsZero() {
@@ -2915,10 +2915,23 @@ func refreshUserProfileProjections(tenantID types.TenantID, uid types.Uid, profi
}
}
if nextCursor == "" {
return
break
}
cursor = nextCursor
}
if topics, err := Users.GetTopics(tenantID, uid, &types.QueryOpt{Limit: 1000}); err != nil {
logs.Warn.Printf("profile %s: refresh group member projections failed: %v", uid, err)
} else {
for _, sub := range topics {
if types.GetTopicCat(sub.Topic) != types.TopicCatGrp {
continue
}
if err := Subs.Update(tenantID, sub.Topic, uid, map[string]any{"Public": public}); err != nil {
logs.Warn.Printf("profile %s: refresh group subscription %s public failed: %v", uid, sub.Topic, err)
}
invalidateGroupMemberPages(tenantID, sub.Topic)
}
}
}
func userProfilePublicProjection(profile *types.UserProfile) map[string]any {
+5
View File
@@ -73,6 +73,10 @@ type GroupMember struct {
Role string `db:"role"`
MemberStatus string `db:"member_status"`
Nickname string `db:"nickname"`
ModeWant AccessMode `db:"modewant"`
ModeGiven AccessMode `db:"modegiven"`
Public any `db:"public"`
Trusted any `db:"trusted"`
Pinned bool `db:"pinned"`
MuteNotifications bool `db:"mute_notifications"`
JoinSource string `db:"join_source"`
@@ -105,6 +109,7 @@ type GroupMemberListOptions struct {
Query string
Cursor string
Limit int
Mentionable bool
}
type GroupInvitation struct {