fix: GetSortedConversationList nil pointer when chatlog not found in v3.8.3-patch branch. (#3569)

3.8.3-patch
Monet Lee 2 days ago committed by GitHub
parent dc7ce098cd
commit 310d70b64e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -168,7 +168,18 @@ func (c *conversationServer) GetSortedConversationList(ctx context.Context, req
conversation_notPinTime := make(map[int64]string) conversation_notPinTime := make(map[int64]string)
for _, v := range conversations { for _, v := range conversations {
conversationID := v.ConversationID conversationID := v.ConversationID
time := conversationMsg[conversationID].MsgInfo.LatestMsgRecvTime var time int64
if _, ok := conversationMsg[conversationID]; ok {
time = conversationMsg[conversationID].MsgInfo.LatestMsgRecvTime
} else {
conversationMsg[conversationID] = &pbconversation.ConversationElem{
ConversationID: conversationID,
IsPinned: v.IsPinned,
MsgInfo: nil,
}
time = v.CreateTime.UnixMilli()
}
conversationMsg[conversationID].RecvMsgOpt = v.RecvMsgOpt conversationMsg[conversationID].RecvMsgOpt = v.RecvMsgOpt
if v.IsPinned { if v.IsPinned {
conversationMsg[conversationID].IsPinned = v.IsPinned conversationMsg[conversationID].IsPinned = v.IsPinned
@ -220,6 +231,7 @@ func (c *conversationServer) getConversations(ctx context.Context, ownerUserID s
return convert.ConversationsDB2Pb(conversations), nil return convert.ConversationsDB2Pb(conversations), nil
} }
// Deprecated
func (c *conversationServer) SetConversation(ctx context.Context, req *pbconversation.SetConversationReq) (*pbconversation.SetConversationResp, error) { func (c *conversationServer) SetConversation(ctx context.Context, req *pbconversation.SetConversationReq) (*pbconversation.SetConversationResp, error) {
var conversation dbModel.Conversation var conversation dbModel.Conversation
if err := datautil.CopyStructFields(&conversation, req.Conversation); err != nil { if err := datautil.CopyStructFields(&conversation, req.Conversation); err != nil {

Loading…
Cancel
Save