From ed9d90f9f339a5739593d4a1abf12cb5af9690dc Mon Sep 17 00:00:00 2001 From: Schmiddiii Date: Wed, 3 Jan 2024 13:48:23 +0100 Subject: [PATCH] Potential fix for expire timer turning off I had the assumption that once an expire timer was set, the field would always be populated. I think now that this assumption is wrong. Therefore, one should only update the expire timer if the field is really set. --- presage/src/manager/registered.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/presage/src/manager/registered.rs b/presage/src/manager/registered.rs index ef5c39cc9..f6ffab491 100644 --- a/presage/src/manager/registered.rs +++ b/presage/src/manager/registered.rs @@ -46,7 +46,7 @@ use tokio::sync::Mutex; use crate::cache::CacheCell; use crate::serde::serde_profile_key; -use crate::store::{Store, Thread}; +use crate::store::{ContentsStore, Store, Thread}; use crate::{Error, Manager}; type ServiceCipher = cipher::ServiceCipher; @@ -1132,7 +1132,9 @@ async fn save_message( store.upsert_profile_key(&sender_uuid, profile_key)?; } - store.update_expire_timer(&thread, data_message.expire_timer.unwrap_or_default())?; + if let Some(expire_timer) = data_message.expire_timer { + store.update_expire_timer(&thread, expire_timer)?; + } match data_message { DataMessage {