|
|
|
@ -761,29 +761,12 @@ func (s *groupServer) GroupApplicationResponse(ctx context.Context, req *pbGroup
|
|
|
|
|
switch req.HandleResult {
|
|
|
|
|
case constant.GroupResponseAgree:
|
|
|
|
|
s.Notification.GroupApplicationAcceptedNotification(ctx, req)
|
|
|
|
|
if !inGroup {
|
|
|
|
|
groupMember := &relationTb.GroupMemberModel{}
|
|
|
|
|
groupMember.GroupID = group.GroupID
|
|
|
|
|
groupMember.RoleLevel = constant.GroupOrdinaryUsers
|
|
|
|
|
groupMember.OperatorUserID = mcontext.GetOpUserID(ctx)
|
|
|
|
|
groupMember.JoinSource = groupRequest.JoinSource
|
|
|
|
|
groupMember.InviterUserID = groupRequest.InviterUserID
|
|
|
|
|
groupMember.JoinTime = time.Now()
|
|
|
|
|
groupMember.MuteEndTime = time.Unix(0, 0)
|
|
|
|
|
if err := CallbackBeforeMemberJoinGroup(ctx, groupMember, group.Ex); err != nil && err != errs.ErrCallbackContinue {
|
|
|
|
|
return nil, err
|
|
|
|
|
}
|
|
|
|
|
if err := s.GroupDatabase.CreateGroup(ctx, nil, []*relationTb.GroupMemberModel{groupMember}); err != nil {
|
|
|
|
|
return nil, err
|
|
|
|
|
}
|
|
|
|
|
if err := s.conversationRpcClient.GroupChatFirstCreateConversation(ctx, req.GroupID, []string{req.FromUserID}); err != nil {
|
|
|
|
|
return nil, err
|
|
|
|
|
}
|
|
|
|
|
s.Notification.MemberEnterNotification(ctx, req)
|
|
|
|
|
}
|
|
|
|
|
case constant.GroupResponseRefuse:
|
|
|
|
|
s.Notification.GroupApplicationRejectedNotification(ctx, req)
|
|
|
|
|
}
|
|
|
|
|
if member != nil {
|
|
|
|
|
s.Notification.MemberEnterNotification(ctx, req)
|
|
|
|
|
}
|
|
|
|
|
return &pbGroup.GroupApplicationResponseResp{}, nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|