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()))