mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-05-09 03:25:59 +08:00
fix bug
This commit is contained in:
@@ -49,6 +49,24 @@ type MsgCallBackResp struct {
|
||||
}
|
||||
}
|
||||
|
||||
func isMessageHasReadEnabled(pb *pbChat.SendMsgReq) (bool, int32, string) {
|
||||
switch pb.MsgData.ContentType {
|
||||
case constant.HasReadReceipt:
|
||||
if config.Config.SingleMessageHasReadReceiptEnable {
|
||||
return true, 0, ""
|
||||
} else {
|
||||
return false, constant.ErrMessageHasReadDisable.ErrCode, constant.ErrMessageHasReadDisable.ErrMsg
|
||||
}
|
||||
case constant.GroupHasReadReceipt:
|
||||
if config.Config.GroupMessageHasReadReceiptEnable {
|
||||
return true, 0, ""
|
||||
} else {
|
||||
return false, constant.ErrMessageHasReadDisable.ErrCode, constant.ErrMessageHasReadDisable.ErrMsg
|
||||
}
|
||||
}
|
||||
return true, 0, ""
|
||||
}
|
||||
|
||||
func userRelationshipVerification(data *pbChat.SendMsgReq) (bool, int32, string) {
|
||||
if data.MsgData.SessionType == constant.SingleChatType {
|
||||
if utils.IsContain(data.MsgData.SendID, config.Config.Manager.AppManagerUid) {
|
||||
@@ -150,7 +168,11 @@ func (rpc *rpcChat) SendMsg(_ context.Context, pb *pbChat.SendMsgReq) (*pbChat.S
|
||||
replay := pbChat.SendMsgResp{}
|
||||
newTime := db.GetCurrentTimestampByMill()
|
||||
log.NewWarn(pb.OperationID, "rpc sendMsg come here", pb.String(), pb.MsgData.ClientMsgID)
|
||||
flag, errCode, errMsg := userRelationshipVerification(pb)
|
||||
flag, errCode, errMsg := isMessageHasReadEnabled(pb)
|
||||
if !flag {
|
||||
return returnMsg(&replay, pb, errCode, errMsg, "", 0)
|
||||
}
|
||||
flag, errCode, errMsg = userRelationshipVerification(pb)
|
||||
if !flag {
|
||||
return returnMsg(&replay, pb, errCode, errMsg, "", 0)
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ func (s *organizationServer) CreateDepartment(ctx context.Context, req *rpc.Crea
|
||||
log.Error(req.OperationID, errMsg)
|
||||
return &rpc.CreateDepartmentResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: errMsg}, nil
|
||||
}
|
||||
err, createdDepartment := imdb.GetDepartment(department.DepartmentID)
|
||||
createdDepartment, err := imdb.GetDepartment(department.DepartmentID)
|
||||
if err != nil {
|
||||
errMsg := req.OperationID + " " + "GetDepartment failed " + err.Error() + department.DepartmentID
|
||||
log.Error(req.OperationID, errMsg)
|
||||
@@ -141,6 +141,9 @@ func (s *organizationServer) CreateDepartment(ctx context.Context, req *rpc.Crea
|
||||
resp.ErrMsg = constant.ErrDB.ErrMsg + " createGroup failed " + createGroupResp.ErrMsg
|
||||
return resp, nil
|
||||
}
|
||||
if err := imdb.SetDepartmentRelatedGroupID(createGroupResp.GroupInfo.GroupID, department.DepartmentID); err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "SetDepartmentRelatedGroupID failed", err.Error())
|
||||
}
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user