|
|
|
@ -21,6 +21,16 @@ func (m *msgServer) GetConversationsHasReadAndMaxSeq(ctx context.Context, req *m
|
|
|
|
|
if err != nil {
|
|
|
|
|
return nil, err
|
|
|
|
|
}
|
|
|
|
|
conversations, err := m.Conversation.GetConversations(ctx, req.UserID, conversationIDs)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return nil, err
|
|
|
|
|
}
|
|
|
|
|
var conversationMaxSeqMap = make(map[string]int64)
|
|
|
|
|
for _, conversation := range conversations {
|
|
|
|
|
if conversation.MaxSeq != 0 {
|
|
|
|
|
conversationMaxSeqMap[conversation.ConversationID] = conversation.MaxSeq
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
maxSeqs, err := m.MsgDatabase.GetMaxSeqs(ctx, conversationIDs)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return nil, err
|
|
|
|
@ -31,6 +41,9 @@ func (m *msgServer) GetConversationsHasReadAndMaxSeq(ctx context.Context, req *m
|
|
|
|
|
HasReadSeq: hasReadSeqs[conversarionID],
|
|
|
|
|
MaxSeq: maxSeq,
|
|
|
|
|
}
|
|
|
|
|
if v, ok := conversationMaxSeqMap[conversarionID]; ok {
|
|
|
|
|
resp.Seqs[conversarionID].MaxSeq = v
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return resp, nil
|
|
|
|
|
}
|
|
|
|
|