From e447bdc0c3cc6000d24e2a672e70cc014997a27c Mon Sep 17 00:00:00 2001 From: "B. Petersen" Date: Mon, 5 Oct 2020 01:32:45 +0200 Subject: [PATCH] simplify code-path --- src/dc_receive_imf.rs | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/src/dc_receive_imf.rs b/src/dc_receive_imf.rs index ce3228e15..ceab5133a 100644 --- a/src/dc_receive_imf.rs +++ b/src/dc_receive_imf.rs @@ -712,20 +712,6 @@ async fn add_parts( // hour, only the message about the change to 1 // week is left. ephemeral_timer = EphemeralTimer::Disabled; - } else if mime_parser.is_system_message == SystemMessage::ChatProtectionEnabled { - set_better_msg( - mime_parser, - chat_id - .get_protection_msg(context, ProtectionStatus::Protected, from_id) - .await, - ); - } else if mime_parser.is_system_message == SystemMessage::ChatProtectionDisabled { - set_better_msg( - mime_parser, - chat_id - .get_protection_msg(context, ProtectionStatus::Unprotected, from_id) - .await, - ); } // change chat protection @@ -733,10 +719,22 @@ async fn add_parts( chat_id .inner_set_protection(context, ProtectionStatus::Protected) .await?; + set_better_msg( + mime_parser, + chat_id + .get_protection_msg(context, ProtectionStatus::Protected, from_id) + .await, + ); } else if mime_parser.is_system_message == SystemMessage::ChatProtectionDisabled { chat_id .inner_set_protection(context, ProtectionStatus::Unprotected) .await?; + set_better_msg( + mime_parser, + chat_id + .get_protection_msg(context, ProtectionStatus::Unprotected, from_id) + .await, + ); } // correct message_timestamp, it should not be used before,