Merge branch 'v2.3.0release' of github.com:OpenIMSDK/Open-IM-Server into v2.3.0release

This commit is contained in:
wangchuxiao
2023-02-10 11:32:25 +08:00
20 changed files with 787 additions and 702 deletions
+3 -1
View File
@@ -38,6 +38,7 @@ func SetOptions(options map[string]bool, value bool) {
func newUserSendMsgReq(params *api.ManagementSendMsgReq) *pbChat.SendMsgReq {
var newContent string
options := make(map[string]bool, 5)
var err error
switch params.ContentType {
case constant.Text:
@@ -57,12 +58,13 @@ func newUserSendMsgReq(params *api.ManagementSendMsgReq) *pbChat.SendMsgReq {
case constant.CustomOnlineOnly:
fallthrough
case constant.AdvancedRevoke:
utils.SetSwitchFromOptions(options, constant.IsUnreadCount, false)
newContent = utils.StructToJsonString(params.Content)
case constant.Revoke:
utils.SetSwitchFromOptions(options, constant.IsUnreadCount, false)
newContent = params.Content["revokeMsgClientID"].(string)
default:
}
options := make(map[string]bool, 5)
if params.IsOnlineOnly {
SetOptions(options, false)
}
+4 -4
View File
@@ -33,7 +33,7 @@ func SetMessageReactionExtensions(c *gin.Context) {
}
var ok bool
var errInfo string
ok, reqPb.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
ok, reqPb.OpUserID, errInfo, reqPb.OpUserIDPlatformID = token_verify.GetUserIDAndPlatformIDFromToken(c.Request.Header.Get("token"), req.OperationID)
if !ok {
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
log.NewError(req.OperationID, errMsg)
@@ -129,7 +129,7 @@ func AddMessageReactionExtensions(c *gin.Context) {
}
var ok bool
var errInfo string
ok, reqPb.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
ok, reqPb.OpUserID, errInfo, reqPb.OpUserIDPlatformID = token_verify.GetUserIDAndPlatformIDFromToken(c.Request.Header.Get("token"), req.OperationID)
if !ok {
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
log.NewError(req.OperationID, errMsg)
@@ -154,8 +154,8 @@ func AddMessageReactionExtensions(c *gin.Context) {
resp.ErrCode = respPb.ErrCode
resp.ErrMsg = respPb.ErrMsg
resp.Data.ResultKeyValue = respPb.Result
resp.Data.MsgFirstModifyTime = reqPb.MsgFirstModifyTime
resp.Data.IsReact = reqPb.IsReact
resp.Data.MsgFirstModifyTime = respPb.MsgFirstModifyTime
resp.Data.IsReact = respPb.IsReact
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), resp)
c.JSON(http.StatusOK, resp)
}
-6
View File
@@ -79,9 +79,6 @@ func MsgToUser(pushMsg *pbPush.PushMsgReq) {
return
}
}
if pushMsg.MsgData.ContentType > constant.NotificationBegin && pushMsg.MsgData.ContentType < constant.NotificationEnd && pushMsg.MsgData.ContentType != constant.SignalingNotification {
return
}
if pushMsg.MsgData.ContentType == constant.SignalingNotification {
isSend, err := db.DB.HandleSignalInfo(pushMsg.OperationID, pushMsg.MsgData, pushMsg.PushToUserID)
if err != nil {
@@ -201,9 +198,6 @@ func MsgToSuperGroupUser(pushMsg *pbPush.PushMsgReq) {
log.Debug(pushMsg.OperationID, "push_result", wsResult, "sendData", pushMsg.MsgData)
successCount++
if isOfflinePush {
if pushMsg.MsgData.ContentType > constant.NotificationBegin && pushMsg.MsgData.ContentType < constant.NotificationEnd && pushMsg.MsgData.ContentType != constant.SignalingNotification {
return
}
var onlineSuccessUserIDList []string
var WebAndPcBackgroundUserIDList []string
onlineSuccessUserIDList = append(onlineSuccessUserIDList, pushMsg.MsgData.SendID)
+8 -1
View File
@@ -743,6 +743,12 @@ func (s *groupServer) KickGroupMember(ctx context.Context, req *pbGroup.KickGrou
resp.ErrMsg = constant.ErrDB.ErrMsg
return &resp, nil
}
if err := rocksCache.DelGroupMemberListHashFromCache(req.GroupID); err != nil {
log.NewError(req.OperationID, utils.GetSelfFuncName(), req.GroupID, err.Error())
}
if err := rocksCache.DelGroupMemberIDListFromCache(req.GroupID); err != nil {
log.NewError(req.OperationID, utils.GetSelfFuncName(), err.Error(), req.GroupID)
}
reqPb := pbConversation.ModifyConversationFieldReq{Conversation: &pbConversation.Conversation{}}
reqPb.OperationID = req.OperationID
reqPb.UserIDList = okUserIDList
@@ -1330,7 +1336,8 @@ func (s *groupServer) SetGroupInfo(ctx context.Context, req *pbGroup.SetGroupInf
}
log.NewInfo(req.OperationID, "SetGroupInfo rpc return ", pbGroup.SetGroupInfoResp{CommonResp: &pbGroup.CommonResp{}})
if changedType != 0 {
chat.GroupInfoSetNotification(req.OperationID, req.OpUserID, req.GroupInfoForSet.GroupID, groupName, notification, introduction, faceURL, req.GroupInfoForSet.NeedVerification)
chat.GroupInfoSetNotification(req.OperationID, req.OpUserID, req.GroupInfoForSet.GroupID, groupName, notification,
introduction, faceURL, req.GroupInfoForSet.NeedVerification, req.GroupInfoForSet.ApplyMemberFriend, req.GroupInfoForSet.LookMemberInfo)
}
if req.GroupInfoForSet.Notification != "" {
//get group member user id
+1 -1
View File
@@ -44,7 +44,7 @@ func (rpc *rpcChat) DelSuperGroupMsg(_ context.Context, req *msg.DelSuperGroupMs
resp.ErrMsg = err.Error()
return resp, nil
}
err = db.DB.SetGroupUserMinSeq(req.GroupID, req.UserID, groupMaxSeq+1)
err = db.DB.SetGroupUserMinSeq(req.GroupID, req.UserID, groupMaxSeq)
if err != nil {
log.NewError(req.OperationID, "SetGroupUserMinSeq false ", req.OpUserID, req.UserID, req.GroupID)
resp.ErrCode = constant.ErrDB.ErrCode
+8 -7
View File
@@ -41,7 +41,7 @@ func (rpc *rpcChat) SetMessageReactionExtensions(ctx context.Context, req *msg.S
}
rResp.MsgFirstModifyTime = callbackResp.MsgFirstModifyTime
rResp.Result = callbackResp.ResultReactionExtensionList
ExtendMessageUpdatedNotification(req.OperationID, req.OpUserID, req.SourceID, req.SessionType, req, &rResp, isHistory, false)
ExtendMessageUpdatedNotification(req.OperationID, req.OpUserID, req.SourceID, req.OpUserIDPlatformID, req.SessionType, req, &rResp, isHistory, false)
return &rResp, nil
}
for _, v := range callbackResp.ResultReactionExtensionList {
@@ -187,12 +187,12 @@ func (rpc *rpcChat) SetMessageReactionExtensions(ctx context.Context, req *msg.S
}
if !isExists {
if !req.IsReact {
ExtendMessageUpdatedNotification(req.OperationID, req.OpUserID, req.SourceID, req.SessionType, req, &rResp, true, true)
ExtendMessageUpdatedNotification(req.OperationID, req.OpUserID, req.SourceID, req.OpUserIDPlatformID, req.SessionType, req, &rResp, true, true)
} else {
ExtendMessageUpdatedNotification(req.OperationID, req.OpUserID, req.SourceID, req.SessionType, req, &rResp, false, false)
ExtendMessageUpdatedNotification(req.OperationID, req.OpUserID, req.SourceID, req.OpUserIDPlatformID, req.SessionType, req, &rResp, false, false)
}
} else {
ExtendMessageUpdatedNotification(req.OperationID, req.OpUserID, req.SourceID, req.SessionType, req, &rResp, false, true)
ExtendMessageUpdatedNotification(req.OperationID, req.OpUserID, req.SourceID, req.OpUserIDPlatformID, req.SessionType, req, &rResp, false, true)
}
log.Debug(req.OperationID, utils.GetSelfFuncName(), "rpc return is:", rResp.String())
return &rResp, nil
@@ -323,7 +323,8 @@ func (rpc *rpcChat) AddMessageReactionExtensions(ctx context.Context, req *msg.A
rResp.MsgFirstModifyTime = callbackResp.MsgFirstModifyTime
rResp.Result = callbackResp.ResultReactionExtensionList
rResp.IsReact = callbackResp.IsReact
ExtendMessageAddedNotification(req.OperationID, req.OpUserID, req.SourceID, req.SessionType, req, &rResp, isHistory, false)
ExtendMessageAddedNotification(req.OperationID, req.OpUserID, req.SourceID, req.OpUserIDPlatformID, req.SessionType, req, &rResp, isHistory, false)
log.Debug(req.OperationID, utils.GetSelfFuncName(), "rpc return is:", resp.String())
return &rResp, nil
}
@@ -346,7 +347,7 @@ func (rpc *rpcChat) DeleteMessageReactionExtensions(ctx context.Context, req *ms
//if ExternalExtension
if req.IsExternalExtensions {
rResp.Result = callbackResp.ResultReactionExtensionList
ExtendMessageDeleteNotification(req.OperationID, req.OpUserID, req.SourceID, req.SessionType, req, &rResp, false, false)
ExtendMessageDeleteNotification(req.OperationID, req.OpUserID, req.SourceID, req.OpUserIDPlatformID, req.SessionType, req, &rResp, false, false)
return &rResp, nil
}
@@ -470,7 +471,7 @@ func (rpc *rpcChat) DeleteMessageReactionExtensions(ctx context.Context, req *ms
}
}
ExtendMessageDeleteNotification(req.OperationID, req.OpUserID, req.SourceID, req.SessionType, req, &rResp, false, isExists)
ExtendMessageDeleteNotification(req.OperationID, req.OpUserID, req.SourceID, req.OpUserIDPlatformID, req.SessionType, req, &rResp, false, isExists)
log.Debug(req.OperationID, utils.GetSelfFuncName(), "rpc return is:", rResp.String())
return &rResp, nil
}
+14 -13
View File
@@ -13,7 +13,7 @@ import (
"strings"
)
func ExtendMessageUpdatedNotification(operationID, sendID string, sourceID string, sessionType int32,
func ExtendMessageUpdatedNotification(operationID, sendID string, sourceID string, senderPlatformID, sessionType int32,
req *msg.SetMessageReactionExtensionsReq, resp *msg.SetMessageReactionExtensionsResp, isHistory bool, isReactionFromCache bool) {
var m base_info.ReactionMessageModifierNotification
m.SourceID = req.SourceID
@@ -35,9 +35,9 @@ func ExtendMessageUpdatedNotification(operationID, sendID string, sourceID strin
m.IsReact = resp.IsReact
m.IsExternalExtensions = req.IsExternalExtensions
m.MsgFirstModifyTime = resp.MsgFirstModifyTime
messageReactionSender(operationID, sendID, sourceID, sessionType, constant.ReactionMessageModifier, utils.StructToJsonString(m), isHistory, isReactionFromCache)
messageReactionSender(operationID, sendID, sourceID, senderPlatformID, sessionType, constant.ReactionMessageModifier, utils.StructToJsonString(m), isHistory, isReactionFromCache)
}
func ExtendMessageAddedNotification(operationID, sendID string, sourceID string, sessionType int32,
func ExtendMessageAddedNotification(operationID, sendID string, sourceID string, senderPlatformID, sessionType int32,
req *msg.AddMessageReactionExtensionsReq, resp *msg.AddMessageReactionExtensionsResp, isHistory bool, isReactionFromCache bool) {
var m base_info.ReactionMessageModifierNotification
m.SourceID = req.SourceID
@@ -59,9 +59,9 @@ func ExtendMessageAddedNotification(operationID, sendID string, sourceID string,
m.IsReact = resp.IsReact
m.IsExternalExtensions = req.IsExternalExtensions
m.MsgFirstModifyTime = resp.MsgFirstModifyTime
messageReactionSender(operationID, sendID, sourceID, sessionType, constant.ReactionMessageModifier, utils.StructToJsonString(m), isHistory, isReactionFromCache)
messageReactionSender(operationID, sendID, sourceID, senderPlatformID, sessionType, constant.ReactionMessageModifier, utils.StructToJsonString(m), isHistory, isReactionFromCache)
}
func ExtendMessageDeleteNotification(operationID, sendID string, sourceID string, sessionType int32,
func ExtendMessageDeleteNotification(operationID, sendID string, sourceID string, senderPlatformID, sessionType int32,
req *msg.DeleteMessageListReactionExtensionsReq, resp *msg.DeleteMessageListReactionExtensionsResp, isHistory bool, isReactionFromCache bool) {
var m base_info.ReactionMessageDeleteNotification
m.SourceID = req.SourceID
@@ -81,9 +81,9 @@ func ExtendMessageDeleteNotification(operationID, sendID string, sourceID string
m.ClientMsgID = req.ClientMsgID
m.MsgFirstModifyTime = req.MsgFirstModifyTime
messageReactionSender(operationID, sendID, sourceID, sessionType, constant.ReactionMessageDeleter, utils.StructToJsonString(m), isHistory, isReactionFromCache)
messageReactionSender(operationID, sendID, sourceID, senderPlatformID, sessionType, constant.ReactionMessageDeleter, utils.StructToJsonString(m), isHistory, isReactionFromCache)
}
func messageReactionSender(operationID, sendID string, sourceID string, sessionType, contentType int32, content string, isHistory bool, isReactionFromCache bool) {
func messageReactionSender(operationID, sendID string, sourceID string, senderPlatformID, sessionType, contentType int32, content string, isHistory bool, isReactionFromCache bool) {
options := make(map[string]bool, 5)
utils.SetSwitchFromOptions(options, constant.IsOfflinePush, false)
utils.SetSwitchFromOptions(options, constant.IsConversationUpdate, false)
@@ -97,12 +97,13 @@ func messageReactionSender(operationID, sendID string, sourceID string, sessionT
pbData := msg.SendMsgReq{
OperationID: operationID,
MsgData: &open_im_sdk.MsgData{
SendID: sendID,
ClientMsgID: utils.GetMsgID(sendID),
SessionType: sessionType,
MsgFrom: constant.SysMsgType,
ContentType: contentType,
Content: []byte(content),
SendID: sendID,
SenderPlatformID: senderPlatformID,
ClientMsgID: utils.GetMsgID(sendID),
SessionType: sessionType,
MsgFrom: constant.SysMsgType,
ContentType: contentType,
Content: []byte(content),
// ForceList: params.ForceList,
CreateTime: utils.GetCurrentTimestampByMill(),
Options: options,
+1 -1
View File
@@ -94,7 +94,7 @@ func callbackAddMessageReactionExtensions(setReq *msg.AddMessageReactionExtensio
MsgFirstModifyTime: setReq.MsgFirstModifyTime,
}
resp := &cbApi.CallbackAddMessageReactionExtResp{CommonCallbackResp: &callbackResp}
defer log.NewDebug(setReq.OperationID, utils.GetSelfFuncName(), req, *resp)
defer log.NewDebug(setReq.OperationID, utils.GetSelfFuncName(), req, *resp, *resp.CommonCallbackResp, resp.IsReact, resp.MsgFirstModifyTime)
if err := http.CallBackPostReturn(config.Config.Callback.CallbackUrl, constant.CallbackAddMessageListReactionExtensionsCommand, req, resp, config.Config.Callback.CallbackAfterSendGroupMsg.CallbackTimeOut); err != nil {
callbackResp.ErrCode = http2.StatusInternalServerError
callbackResp.ErrMsg = err.Error()
+10 -1
View File
@@ -245,12 +245,15 @@ func GroupCreatedNotification(operationID, opUserID, groupID string, initMemberL
// notification := ""
// introduction := ""
// faceURL := ""
func GroupInfoSetNotification(operationID, opUserID, groupID string, groupName, notification, introduction, faceURL string, needVerification *wrapperspb.Int32Value) {
func GroupInfoSetNotification(operationID, opUserID, groupID string, groupName, notification, introduction, faceURL string, needVerification, applyMemberFriend, lookMemberInfo *wrapperspb.Int32Value) {
GroupInfoChangedTips := open_im_sdk.GroupInfoSetTips{Group: &open_im_sdk.GroupInfo{}, OpUser: &open_im_sdk.GroupMemberFullInfo{}}
if err := setGroupInfo(groupID, GroupInfoChangedTips.Group); err != nil {
log.Error(operationID, "setGroupInfo failed ", err.Error(), groupID)
return
}
GroupInfoChangedTips.Group.NeedVerification = 0
GroupInfoChangedTips.Group.LookMemberInfo = 0
GroupInfoChangedTips.Group.ApplyMemberFriend = 0
GroupInfoChangedTips.Group.GroupName = groupName
GroupInfoChangedTips.Group.Notification = notification
GroupInfoChangedTips.Group.Introduction = introduction
@@ -258,6 +261,12 @@ func GroupInfoSetNotification(operationID, opUserID, groupID string, groupName,
if needVerification != nil {
GroupInfoChangedTips.Group.NeedVerification = needVerification.Value
}
if applyMemberFriend != nil {
GroupInfoChangedTips.Group.ApplyMemberFriend = applyMemberFriend.Value
}
if lookMemberInfo != nil {
GroupInfoChangedTips.Group.LookMemberInfo = lookMemberInfo.Value
}
if err := setOpUserInfo(opUserID, groupID, GroupInfoChangedTips.OpUser); err != nil {
log.Error(operationID, "setOpUserInfo failed ", err.Error(), opUserID, groupID)
@@ -18,6 +18,7 @@ func SuperGroupNotification(operationID, sendID, recvID string) {
SessionType: constant.SingleChatType,
OperationID: operationID,
}
log.NewInfo(operationID, utils.GetSelfFuncName(), string(n.Content))
Notification(n)
}