Skip to content

Commit 35dc5d9

Browse files
committed
cleanup
squash
1 parent 2c6add0 commit 35dc5d9

File tree

2 files changed

+14
-15
lines changed

2 files changed

+14
-15
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?;

src/webxdc/webxdc_tests.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1633,7 +1633,6 @@ async fn test_webxdc_info_msg_delete() -> Result<()> {
16331633
assert_eq!(chat_id.get_msg_cnt(&t).await?, 4);
16341634
delete_msgs(&t, &[instance.id]).await?;
16351635
assert_eq!(chat_id.get_msg_cnt(&t).await?, 1);
1636-
16371636
Ok(())
16381637
}
16391638

0 commit comments

Comments
 (0)