From 4a5fbcb13affd06f6f6ec760d5b0726beddea257 Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Thu, 12 May 2022 18:08:09 +0300 Subject: [PATCH] Fix disappearing message notice spam when backfilling --- historysync.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/historysync.go b/historysync.go index 137ee7c..69d403c 100644 --- a/historysync.go +++ b/historysync.go @@ -140,7 +140,7 @@ func (user *User) backfillInChunks(req *database.Backfill, conv *database.Histor // a notice indicating so. if len(allMsgs) == 0 && conv.EphemeralExpiration != nil && *conv.EphemeralExpiration > 0 { lastMessage := portal.bridge.DB.Message.GetLastInChat(portal.Key) - if lastMessage == nil || !conv.LastMessageTimestamp.Equal(lastMessage.Timestamp) { + if lastMessage == nil || conv.LastMessageTimestamp.After(lastMessage.Timestamp) { sendDisappearedNotice = true } } @@ -177,6 +177,7 @@ func (user *User) backfillInChunks(req *database.Backfill, conv *database.Histor msg.JID = types.MessageID(resp.EventID) msg.Timestamp = conv.LastMessageTimestamp msg.Sent = true + msg.Type = database.MsgFake msg.Insert() return }