fix: 优化群成员分页并补齐头像资料
This commit is contained in:
+15
-2
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user