From 419cd7dff7345d7978288c63a9a4ff8a9938209a Mon Sep 17 00:00:00 2001 From: ryanzhao Date: Wed, 21 Jun 2023 16:55:41 +1000 Subject: [PATCH] delete outdated control messages for disappearing messages --- .../SessionUtil/Config Handling/SessionUtil+Contacts.swift | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/SessionMessagingKit/SessionUtil/Config Handling/SessionUtil+Contacts.swift b/SessionMessagingKit/SessionUtil/Config Handling/SessionUtil+Contacts.swift index 7112e65c4..c66d59b3e 100644 --- a/SessionMessagingKit/SessionUtil/Config Handling/SessionUtil+Contacts.swift +++ b/SessionMessagingKit/SessionUtil/Config Handling/SessionUtil+Contacts.swift @@ -199,6 +199,12 @@ internal extension SessionUtil { type: data.config.type, lastChangeTimestampMs: data.config.lastChangeTimestampMs ).save(db) + + _ = try Interaction + .filter(Interaction.Columns.threadId == sessionId) + .filter(Interaction.Columns.variant == Interaction.Variant.infoDisappearingMessagesUpdate) + .filter(Interaction.Columns.timestampMs <= (remoteLastChangeTimestampMs - Int64(data.config.durationSeconds * 1000))) + .deleteAll(db) } }