From 948cefa3ef65a31d7c72cd456e4e9f6ddcf1c1bb Mon Sep 17 00:00:00 2001 From: link2xt Date: Sun, 12 Nov 2023 11:03:21 +0000 Subject: [PATCH] fix: do not add protection messages to Saved Messages chat This causes troubles such as adding this message the first time a sync message is sent. --- src/chat.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/chat.rs b/src/chat.rs index 7587d9b4d0..067eac5629 100644 --- a/src/chat.rs +++ b/src/chat.rs @@ -567,6 +567,14 @@ impl ChatId { contact_id: Option, timestamp_sort: i64, ) -> Result<()> { + if contact_id == Some(ContactId::SELF) { + // Do not add protection messages to Saved Messages chat. + // This chat never gets protected and unprotected, + // we do not want the first message + // to be a protection message with an arbitrary timestamp. + return Ok(()); + } + let text = context.stock_protection_msg(protect, contact_id).await; let cmd = match protect { ProtectionStatus::Protected => SystemMessage::ChatProtectionEnabled,