From d9314227ee657c910d823a6df50aca95456ad3c6 Mon Sep 17 00:00:00 2001 From: Alexander Krotov Date: Thu, 2 Jul 2020 12:46:27 +0300 Subject: [PATCH] Do not duplicate system messages about timer changes Instead, replace them with localized stock strings using set_better_msg. --- src/dc_receive_imf.rs | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/dc_receive_imf.rs b/src/dc_receive_imf.rs index ef3a11d7a..a977ac6d1 100644 --- a/src/dc_receive_imf.rs +++ b/src/dc_receive_imf.rs @@ -653,12 +653,20 @@ async fn add_parts( { match (*chat_id).inner_set_ephemeral_timer(context, timer).await { Ok(()) => { - chat::add_info_msg( - context, - *chat_id, - stock_ephemeral_timer_changed(context, timer, from_id).await, - ) - .await; + if mime_parser.is_system_message == SystemMessage::EphemeralTimerChanged { + set_better_msg( + mime_parser, + stock_ephemeral_timer_changed(context, timer, from_id).await, + ); + } else { + chat::add_info_msg( + context, + *chat_id, + stock_ephemeral_timer_changed(context, timer, from_id).await, + ) + .await; + } + context.emit_event(Event::ChatEphemeralTimerModified { chat_id: *chat_id, timer: timer.to_u32(),