From 29099901d1859cddfdb5b49afc288dec03c178fd Mon Sep 17 00:00:00 2001 From: andrew Date: Fri, 10 Nov 2023 12:51:58 +1030 Subject: [PATCH] Pick correct config on receive message --- .../messaging/sending_receiving/ReceivedMessageHandler.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libsession/src/main/java/org/session/libsession/messaging/sending_receiving/ReceivedMessageHandler.kt b/libsession/src/main/java/org/session/libsession/messaging/sending_receiving/ReceivedMessageHandler.kt index 58e6c0b878..e23535805b 100644 --- a/libsession/src/main/java/org/session/libsession/messaging/sending_receiving/ReceivedMessageHandler.kt +++ b/libsession/src/main/java/org/session/libsession/messaging/sending_receiving/ReceivedMessageHandler.kt @@ -310,9 +310,9 @@ fun MessageReceiver.updateExpiryIfNeeded( storage.updateDisappearingState(threadID, disappearingState) } - if (localConfig != null || localConfig!!) { - storage.setExpirationConfiguration(remoteConfig) - } + remoteConfig.takeIf { localConfig == null || it.updatedTimestampMs > localConfig.updatedTimestampMs } + ?.let(storage::setExpirationConfiguration) + if (message is ExpirationTimerUpdate) { SSKEnvironment.shared.messageExpirationManager.setExpirationTimer(message, type?.expiryMode(durationSeconds.toLong()))