Skip to content

Commit

Permalink
Merge pull request #9 from icey-yu/fix-is-in-group
Browse files Browse the repository at this point in the history
fix:is in group
  • Loading branch information
FGadvancer committed Jun 27, 2024
2 parents 5e51f9f + 4958169 commit ac011dd
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions internal/group/sdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -352,17 +352,16 @@ func (g *Group) SearchGroupMembers(ctx context.Context, searchParam *sdk_params_
}

func (g *Group) IsJoinGroup(ctx context.Context, groupID string) (bool, error) {
groupList, err := g.db.GetJoinedGroupListDB(ctx)
groupIDs, err := g.db.GetVersionSync(ctx, g.groupTableName(), g.loginUserID)
if err != nil {
return false, err
}
for _, localGroup := range groupList {
if localGroup.GroupID == groupID {
return true, nil
}
if datautil.Contain(groupID, groupIDs.UIDList...) {
return true, nil
}
return false, nil
}

func (g *Group) InviteUserToGroup(ctx context.Context, groupID, reason string, userIDList []string) error {
if err := util.ApiPost(ctx, constant.InviteUserToGroupRouter, &group.InviteUserToGroupReq{GroupID: groupID, Reason: reason, InvitedUserIDs: userIDList}, nil); err != nil {
return err
Expand Down

0 comments on commit ac011dd

Please sign in to comment.