fix: improve condition check. (#2815)

This commit is contained in:
Monet Lee 2024-10-31 11:21:14 +08:00 committed by OpenIM-Robot
parent f707069089
commit 625fa77e89

View File

@ -1811,7 +1811,6 @@ func (g *groupServer) GetSpecifiedUserGroupRequestInfo(ctx context.Context, req
} }
if req.UserID != opUserID { if req.UserID != opUserID {
req.UserID = mcontext.GetOpUserID(ctx)
adminIDs, err := g.db.GetGroupRoleLevelMemberIDs(ctx, req.GroupID, constant.GroupAdmin) adminIDs, err := g.db.GetGroupRoleLevelMemberIDs(ctx, req.GroupID, constant.GroupAdmin)
if err != nil { if err != nil {
return nil, err return nil, err
@ -1820,10 +1819,11 @@ func (g *groupServer) GetSpecifiedUserGroupRequestInfo(ctx context.Context, req
adminIDs = append(adminIDs, owners[0].UserID) adminIDs = append(adminIDs, owners[0].UserID)
adminIDs = append(adminIDs, g.config.Share.IMAdminUserID...) adminIDs = append(adminIDs, g.config.Share.IMAdminUserID...)
if !datautil.Contain(req.UserID, adminIDs...) { if !datautil.Contain(opUserID, adminIDs...) {
return nil, errs.ErrNoPermission.WrapMsg("opUser no permission") return nil, errs.ErrNoPermission.WrapMsg("opUser no permission")
} }
} }
requests, err := g.db.FindGroupRequests(ctx, req.GroupID, []string{req.UserID}) requests, err := g.db.FindGroupRequests(ctx, req.GroupID, []string{req.UserID})
if err != nil { if err != nil {
return nil, err return nil, err