|
|
@ -49,7 +49,7 @@ func (rpc *rpcConversation) ModifyConversationField(c context.Context, req *pbCo
|
|
|
|
}
|
|
|
|
}
|
|
|
|
haveUserID, _ := imdb.GetExistConversationUserIDList(req.Conversation.ConversationID)
|
|
|
|
haveUserID, _ := imdb.GetExistConversationUserIDList(req.Conversation.ConversationID)
|
|
|
|
switch req.FieldType {
|
|
|
|
switch req.FieldType {
|
|
|
|
case constant.RecvMsgOpt:
|
|
|
|
case constant.FieldRecvMsgOpt:
|
|
|
|
for _, v := range req.UserIDList {
|
|
|
|
for _, v := range req.UserIDList {
|
|
|
|
if err = db.DB.SetSingleConversationRecvMsgOpt(v, req.Conversation.ConversationID, req.Conversation.RecvMsgOpt); err != nil {
|
|
|
|
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())
|
|
|
|
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})
|
|
|
|
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})
|
|
|
|
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})
|
|
|
|
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})
|
|
|
|
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})
|
|
|
|
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})
|
|
|
|
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})
|
|
|
|
err = imdb.UpdateColumnsConversations(haveUserID, req.Conversation.ConversationID, map[string]interface{}{"attached_info": conversation.AttachedInfo})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
@ -86,7 +86,7 @@ func (rpc *rpcConversation) ModifyConversationField(c context.Context, req *pbCo
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// notification
|
|
|
|
// 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
|
|
|
|
//sync peer user conversation if conversation is singleChatType
|
|
|
|
if err := syncPeerUserConversation(req.Conversation, req.OperationID); err != nil {
|
|
|
|
if err := syncPeerUserConversation(req.Conversation, req.OperationID); err != nil {
|
|
|
|
log.NewError(req.OperationID, utils.GetSelfFuncName(), "syncPeerUserConversation", err.Error())
|
|
|
|
log.NewError(req.OperationID, utils.GetSelfFuncName(), "syncPeerUserConversation", err.Error())
|
|
|
|