Skip to content

Commit 780a3e9

Browse files
committed
cleanup
1 parent 2c6add0 commit 780a3e9

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

src/message.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1816,16 +1816,21 @@ pub async fn delete_msgs_ex(
18161816
}
18171817
res?;
18181818

1819-
let (info_msg_ids, info_msg_rfc724): (Vec<MsgId>, Vec<_>) =
1820-
deleted_info_msgs.into_iter().unzip();
1821-
if !info_msg_rfc724.is_empty() && modified_chat_ids.len() > 1 {
1822-
bail!("Can delete only from same chat.");
1823-
}
1819+
if !deleted_info_msgs.is_empty() {
1820+
if modified_chat_ids.len() > 1 {
1821+
bail!("Can delete only from same chat.");
1822+
}
1823+
let (info_msg_ids, info_msg_rfc724): (Vec<MsgId>, Vec<_>) =
1824+
deleted_info_msgs.into_iter().unzip();
18241825

1825-
if let Some(chat_id) = modified_chat_ids.iter().next()
1826-
&& !info_msg_rfc724.is_empty()
1827-
{
1828-
send_delete_request(context, &info_msg_rfc724, chat_id).await?;
1826+
for &msg_id in &info_msg_ids {
1827+
let msg = Message::load_from_db(context, msg_id).await?;
1828+
delete_msg_locally(context, &msg).await?;
1829+
}
1830+
1831+
if let Some(chat_id) = modified_chat_ids.iter().next() {
1832+
send_delete_request(context, &info_msg_rfc724, chat_id).await?;
1833+
}
18291834
}
18301835

18311836
if delete_for_all {
@@ -1844,11 +1849,6 @@ pub async fn delete_msgs_ex(
18441849
.await?;
18451850
}
18461851

1847-
for &msg_id in &info_msg_ids {
1848-
let msg = Message::load_from_db(context, msg_id).await?;
1849-
delete_msg_locally(context, &msg).await?;
1850-
}
1851-
18521852
for &msg_id in msg_ids {
18531853
let msg = Message::load_from_db(context, msg_id).await?;
18541854
delete_msg_locally(context, &msg).await?;

0 commit comments

Comments
 (0)