add modify conversation api

pull/455/head
Gordon 3 years ago committed by Xinwei Xiong(cubxxw-openim)
parent 9e593085c1
commit 9b6446c95e

@ -49,7 +49,7 @@ func (rpc *rpcConversation) ModifyConversationField(c context.Context, req *pbCo
}
haveUserID, _ := imdb.GetExistConversationUserIDList(req.Conversation.ConversationID)
switch req.FieldType {
case constant.RecvMsgOpt:
case constant.FieldRecvMsgOpt:
for _, v := range req.UserIDList {
if err = db.DB.SetSingleConversationRecvMsgOpt(v, req.Conversation.ConversationID, req.Conversation.RecvMsgOpt); err != nil {
log.NewError(req.OperationID, utils.GetSelfFuncName(), "cache failed, rpc return", err.Error())
@ -58,17 +58,17 @@ func (rpc *rpcConversation) ModifyConversationField(c context.Context, req *pbCo
}
}
err = imdb.UpdateColumnsConversations(haveUserID, req.Conversation.ConversationID, map[string]interface{}{"recv_msg_opt": conversation.RecvMsgOpt})
case constant.GroupAtType:
case constant.FieldGroupAtType:
err = imdb.UpdateColumnsConversations(haveUserID, req.Conversation.ConversationID, map[string]interface{}{"group_at_type": conversation.GroupAtType})
case constant.IsNotInGroup:
case constant.FieldIsNotInGroup:
err = imdb.UpdateColumnsConversations(haveUserID, req.Conversation.ConversationID, map[string]interface{}{"is_not_in_group": conversation.IsNotInGroup})
case constant.IsPinned:
case constant.FieldIsPinned:
err = imdb.UpdateColumnsConversations(haveUserID, req.Conversation.ConversationID, map[string]interface{}{"is_pinned": conversation.IsPinned})
case constant.IsPrivateChat:
case constant.FieldIsPrivateChat:
err = imdb.UpdateColumnsConversations(haveUserID, req.Conversation.ConversationID, map[string]interface{}{"is_private_chat": conversation.IsPrivateChat})
case constant.Ex:
case constant.FieldEx:
err = imdb.UpdateColumnsConversations(haveUserID, req.Conversation.ConversationID, map[string]interface{}{"ex": conversation.Ex})
case constant.AttachedInfo:
case constant.FieldAttachedInfo:
err = imdb.UpdateColumnsConversations(haveUserID, req.Conversation.ConversationID, map[string]interface{}{"attached_info": conversation.AttachedInfo})
}
if err != nil {
@ -86,7 +86,7 @@ func (rpc *rpcConversation) ModifyConversationField(c context.Context, req *pbCo
}
}
// notification
if req.Conversation.ConversationType == constant.SingleChatType && req.FieldType == constant.IsPrivateChat {
if req.Conversation.ConversationType == constant.SingleChatType && req.FieldType == constant.FieldIsPrivateChat {
//sync peer user conversation if conversation is singleChatType
if err := syncPeerUserConversation(req.Conversation, req.OperationID); err != nil {
log.NewError(req.OperationID, utils.GetSelfFuncName(), "syncPeerUserConversation", err.Error())

@ -265,7 +265,7 @@ func (rpc *rpcChat) SendMsg(_ context.Context, pb *pbChat.SendMsgReq) (*pbChat.S
}
conversationReq.Conversation = &conversation
conversationReq.OperationID = pb.OperationID
conversationReq.FieldType = constant.GroupAtType
conversationReq.FieldType = constant.FieldGroupAtType
tagAll := utils.IsContain(constant.AtAllString, pb.MsgData.AtUserIDList)
if tagAll {
atUserID = utils.DifferenceString([]string{constant.AtAllString}, pb.MsgData.AtUserIDList)

@ -201,13 +201,13 @@ var ContentType2PushContent = map[int64]string{
}
const (
RecvMsgOpt = 1
IsPinned = 2
AttachedInfo = 3
IsPrivateChat = 4
GroupAtType = 5
IsNotInGroup = 6
Ex = 7
FieldRecvMsgOpt = 1
FieldIsPinned = 2
FieldAttachedInfo = 3
FieldIsPrivateChat = 4
FieldGroupAtType = 5
FieldIsNotInGroup = 6
FieldEx = 7
)
const (

Loading…
Cancel
Save