|
|
|
@ -207,10 +207,14 @@ func (s *groupServer) InviteUserToGroup(ctx context.Context, req *pbGroup.Invite
|
|
|
|
|
return &pbGroup.InviteUserToGroupResp{ErrCode: constant.ErrAccess.ErrCode, ErrMsg: constant.ErrAccess.ErrMsg}, nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_, err := imdb.GetGroupInfoByGroupID(req.GroupID)
|
|
|
|
|
groupInfo, err := imdb.GetGroupInfoByGroupID(req.GroupID)
|
|
|
|
|
if err != nil {
|
|
|
|
|
log.NewError(req.OperationID, "GetGroupInfoByGroupID failed ", req.GroupID, err)
|
|
|
|
|
return &pbGroup.InviteUserToGroupResp{ErrCode: constant.ErrAccess.ErrCode, ErrMsg: constant.ErrAccess.ErrMsg}, nil
|
|
|
|
|
return &pbGroup.InviteUserToGroupResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}, nil
|
|
|
|
|
}
|
|
|
|
|
if groupInfo.Status == constant.GroupStatusDismissed {
|
|
|
|
|
errMsg := " group status is dismissed "
|
|
|
|
|
return &pbGroup.InviteUserToGroupResp{ErrCode: constant.ErrStatus.ErrCode, ErrMsg: errMsg}, nil
|
|
|
|
|
}
|
|
|
|
|
//
|
|
|
|
|
//from User: invite: applicant
|
|
|
|
@ -518,6 +522,16 @@ func (s *groupServer) JoinGroup(ctx context.Context, req *pbGroup.JoinGroupReq)
|
|
|
|
|
return &pbGroup.JoinGroupResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}}, nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
groupInfo, err := imdb.GetGroupInfoByGroupID(req.GroupID)
|
|
|
|
|
if err != nil {
|
|
|
|
|
log.NewError(req.OperationID, "GetGroupInfoByGroupID failed ", req.GroupID, err)
|
|
|
|
|
return &pbGroup.JoinGroupResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}}, nil
|
|
|
|
|
}
|
|
|
|
|
if groupInfo.Status == constant.GroupStatusDismissed {
|
|
|
|
|
errMsg := " group status is dismissed "
|
|
|
|
|
return &pbGroup.JoinGroupResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrStatus.ErrCode, ErrMsg: errMsg}}, nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var groupRequest db.GroupRequest
|
|
|
|
|
groupRequest.UserID = req.OpUserID
|
|
|
|
|
groupRequest.ReqMsg = req.ReqMessage
|
|
|
|
@ -595,6 +609,11 @@ func (s *groupServer) SetGroupInfo(ctx context.Context, req *pbGroup.SetGroupInf
|
|
|
|
|
return &pbGroup.SetGroupInfoResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrAccess.ErrMsg}}, http.WrapError(constant.ErrDB)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if group.Status == constant.GroupStatusDismissed {
|
|
|
|
|
errMsg := " group status is dismissed "
|
|
|
|
|
return &pbGroup.SetGroupInfoResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrStatus.ErrCode, ErrMsg: errMsg}}, nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
////bitwise operators: 0001:groupName; 0010:Notification 0100:Introduction; 1000:FaceUrl; 10000:owner
|
|
|
|
|
var changedType int32
|
|
|
|
|
if group.GroupName != req.GroupInfo.GroupName && req.GroupInfo.GroupName != "" {
|
|
|
|
@ -627,6 +646,16 @@ func (s *groupServer) SetGroupInfo(ctx context.Context, req *pbGroup.SetGroupInf
|
|
|
|
|
func (s *groupServer) TransferGroupOwner(_ context.Context, req *pbGroup.TransferGroupOwnerReq) (*pbGroup.TransferGroupOwnerResp, error) {
|
|
|
|
|
log.NewInfo(req.OperationID, "TransferGroupOwner ", req.String())
|
|
|
|
|
|
|
|
|
|
groupInfo, err := imdb.GetGroupInfoByGroupID(req.GroupID)
|
|
|
|
|
if err != nil {
|
|
|
|
|
log.NewError(req.OperationID, "GetGroupInfoByGroupID failed ", req.GroupID, err)
|
|
|
|
|
return &pbGroup.TransferGroupOwnerResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}}, nil
|
|
|
|
|
}
|
|
|
|
|
if groupInfo.Status == constant.GroupStatusDismissed {
|
|
|
|
|
errMsg := " group status is dismissed "
|
|
|
|
|
return &pbGroup.TransferGroupOwnerResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrStatus.ErrCode, ErrMsg: errMsg}}, nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if req.OldOwnerUserID == req.NewOwnerUserID {
|
|
|
|
|
log.NewError(req.OperationID, "same owner ", req.OldOwnerUserID, req.NewOwnerUserID)
|
|
|
|
|
return &pbGroup.TransferGroupOwnerResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrArgs.ErrCode, ErrMsg: constant.ErrArgs.ErrMsg}}, nil
|
|
|
|
|