diff --git a/pkg/hicli/database/room.go b/pkg/hicli/database/room.go index 6e46001..31eeb5f 100644 --- a/pkg/hicli/database/room.go +++ b/pkg/hicli/database/room.go @@ -80,7 +80,7 @@ const ( AND (type IN ('m.room.message', 'm.sticker') OR (type = 'm.room.encrypted' AND decrypted_type IN ('m.room.message', 'm.sticker'))) - AND relation_type <> 'm.replace' + AND (relation_type IS NULL OR relation_type <> 'm.replace') AND redacted_by IS NULL ORDER BY timestamp DESC LIMIT 1 @@ -215,7 +215,7 @@ func (r *Room) CheckChangesAndCopyInto(other *Room) (hasChanges bool) { hasChanges = true other.HasMemberList = true } - if r.PreviewEventRowID > other.PreviewEventRowID { + if r.PreviewEventRowID != 0 { other.PreviewEventRowID = r.PreviewEventRowID hasChanges = true } diff --git a/pkg/hicli/sync.go b/pkg/hicli/sync.go index 2ebb28f..2acf12d 100644 --- a/pkg/hicli/sync.go +++ b/pkg/hicli/sync.go @@ -785,7 +785,7 @@ func (h *HiClient) processStateAndTimeline( return fmt.Errorf("failed to get relation target of redaction target: %w", err) } } - if updatedRoom.PreviewEventRowID == dbEvt.RowID { + if updatedRoom.PreviewEventRowID == dbEvt.RowID || (updatedRoom.PreviewEventRowID == 0 && room.PreviewEventRowID == dbEvt.RowID) { updatedRoom.PreviewEventRowID = 0 recalculatePreviewEvent = true }