do not assume 'no ephemeral timer' on partial downloads (#2811)

* do not assume 'no ephemeral timer' on partial downloads

* add a test to check that ephemeral timers are not disabled on partial downloads
This commit is contained in:
bjoern
2021-11-15 11:45:06 +01:00
committed by GitHub
parent 0d62069b67
commit eebb2a3b68
2 changed files with 41 additions and 3 deletions

View File

@@ -864,9 +864,10 @@ async fn add_parts(
DC_CHAT_ID_TRASH
});
// Extract ephemeral timer from the message.
let mut ephemeral_timer = if let Some(value) = mime_parser.get_header(HeaderDef::EphemeralTimer)
{
// Extract ephemeral timer from the message or use the existing timer if the message is not fully downloaded.
let mut ephemeral_timer = if is_partial_download.is_some() {
chat_id.get_ephemeral_timer(context).await?
} else if let Some(value) = mime_parser.get_header(HeaderDef::EphemeralTimer) {
match value.parse::<EphemeralTimer>() {
Ok(timer) => timer,
Err(err) => {