|
|
|
@ -1068,6 +1068,7 @@ func (s *groupServer) GetGroups(ctx context.Context, req *pbgroup.GetGroupsReq)
|
|
|
|
|
group []*relationtb.GroupModel
|
|
|
|
|
err error
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
if req.GroupID != "" {
|
|
|
|
|
group, err = s.db.FindGroup(ctx, []string{req.GroupID})
|
|
|
|
|
resp.Total = uint32(len(group))
|
|
|
|
@ -1080,15 +1081,7 @@ func (s *groupServer) GetGroups(ctx context.Context, req *pbgroup.GetGroupsReq)
|
|
|
|
|
return nil, err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var groups []*relationtb.GroupModel
|
|
|
|
|
for _, v := range group {
|
|
|
|
|
if v.Status == constant.GroupStatusDismissed {
|
|
|
|
|
resp.Total--
|
|
|
|
|
continue
|
|
|
|
|
}
|
|
|
|
|
groups = append(groups, v)
|
|
|
|
|
}
|
|
|
|
|
groupIDs := utils.Slice(groups, func(e *relationtb.GroupModel) string {
|
|
|
|
|
groupIDs := utils.Slice(group, func(e *relationtb.GroupModel) string {
|
|
|
|
|
return e.GroupID
|
|
|
|
|
})
|
|
|
|
|
ownerMembers, err := s.db.FindGroupsOwner(ctx, groupIDs)
|
|
|
|
@ -1102,7 +1095,7 @@ func (s *groupServer) GetGroups(ctx context.Context, req *pbgroup.GetGroupsReq)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return nil, err
|
|
|
|
|
}
|
|
|
|
|
resp.Groups = utils.Slice(groups, func(group *relationtb.GroupModel) *pbgroup.CMSGroup {
|
|
|
|
|
resp.Groups = utils.Slice(group, func(group *relationtb.GroupModel) *pbgroup.CMSGroup {
|
|
|
|
|
var (
|
|
|
|
|
userID string
|
|
|
|
|
username string
|
|
|
|
|