Skip to content

Commit 9270ddc

Browse files
authored
fix: quote message change to revoke message when app from background to foreground and message status update. (#825)
Signed-off-by: Gordon <[email protected]>
1 parent c3f148d commit 9270ddc

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

internal/conversation_msg/api.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -517,6 +517,11 @@ func (c *Conversation) SendMessage(ctx context.Context, s *sdk_struct.MsgStruct,
517517
case constant.Merger:
518518
s.Content = utils.StructToJsonString(s.MergeElem)
519519
case constant.Quote:
520+
quoteMessage, err := c.db.GetMessage(ctx, lc.ConversationID, s.QuoteElem.QuoteMessage.ClientMsgID)
521+
if err != nil {
522+
log.ZWarn(ctx, "quote message not found", err)
523+
}
524+
s.QuoteElem.QuoteMessage.Seq = quoteMessage.Seq
520525
s.Content = utils.StructToJsonString(s.QuoteElem)
521526
case constant.Card:
522527
s.Content = utils.StructToJsonString(s.CardElem)

internal/conversation_msg/conversion.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,19 @@ func MsgDataToLocalChatLog(serverMessage *sdkws.MsgData) *model_struct.LocalChat
7979
ContentType: serverMessage.ContentType,
8080
Content: string(serverMessage.Content),
8181
IsRead: serverMessage.IsRead,
82-
Status: constant.MsgStatusSendSuccess,
8382
Seq: serverMessage.Seq,
8483
SendTime: serverMessage.SendTime,
8584
CreateTime: serverMessage.CreateTime,
8685
AttachedInfo: serverMessage.AttachedInfo,
8786
Ex: serverMessage.Ex,
8887
}
88+
89+
if serverMessage.Status >= constant.MsgStatusHasDeleted {
90+
localMessage.Status = serverMessage.Status
91+
} else {
92+
localMessage.Status = constant.MsgStatusSendSuccess
93+
}
94+
8995
if serverMessage.SessionType == constant.WriteGroupChatType || serverMessage.SessionType == constant.ReadGroupChatType {
9096
localMessage.RecvID = serverMessage.GroupID
9197
}

internal/conversation_msg/message_check.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -364,11 +364,11 @@ func (c *Conversation) pullMessageIntoTable(ctx context.Context, pullMsgData map
364364
log.ZDebug(ctx, "msg detail", "msg", v, "conversationID", conversationID)
365365
//When the message has been marked and deleted by the cloud, it is directly inserted locally
366366
//without any conversation and message update.
367+
msg := MsgDataToLocalChatLog(v)
367368
if v.Status == constant.MsgStatusHasDeleted {
368-
insertMessage = append(insertMessage, MsgDataToLocalChatLog(v))
369+
insertMessage = append(insertMessage, msg)
369370
continue
370371
}
371-
msg := MsgDataToLocalChatLog(v)
372372
// The message might be a filler provided by the server due to a gap in the sequence.
373373
if msg.ClientMsgID == "" {
374374
msg.ClientMsgID = utils.GetMsgID(c.loginUserID) + utils.Int64ToString(msg.Seq)

0 commit comments

Comments
 (0)