From 1394f5add71de7ed8f201bc2c34d507f859e9b8f Mon Sep 17 00:00:00 2001 From: withchao <993506633@qq.com> Date: Tue, 18 Apr 2023 14:22:05 +0800 Subject: [PATCH] group --- internal/rpc/group/group.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/rpc/group/group.go b/internal/rpc/group/group.go index 8fe4ec342..2242f5385 100644 --- a/internal/rpc/group/group.go +++ b/internal/rpc/group/group.go @@ -684,10 +684,13 @@ func (s *groupServer) QuitGroup(ctx context.Context, req *pbGroup.QuitGroupReq) } s.Notification.SuperGroupNotification(ctx, mcontext.GetOpUserID(ctx), mcontext.GetOpUserID(ctx)) } else { - _, err := s.GroupDatabase.TakeGroupMember(ctx, req.GroupID, mcontext.GetOpUserID(ctx)) + info, err := s.GroupDatabase.TakeGroupMember(ctx, req.GroupID, mcontext.GetOpUserID(ctx)) if err != nil { return nil, err } + if info.RoleLevel == constant.GroupOwner { + return nil, errs.ErrNoPermission.Wrap("group owner can't quit") + } err = s.GroupDatabase.DeleteGroupMember(ctx, req.GroupID, []string{mcontext.GetOpUserID(ctx)}) if err != nil { return nil, err