Skip to content

Commit ea87c78

Browse files
committed
Do not return media from trashed messages in the "All media" view.
1 parent a2927a6 commit ea87c78

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
- transfer backup: Connect to mutliple provider addresses concurrently. This should speed up connection time significantly on the getter side. #4240
88
- Make sure BackupProvider is cancelled on drop (or dc_backup_provider_unref). The BackupProvider will now alaway finish with an IMEX event of 1000 or 0, previoulsy it would sometimes finishe with 1000 (success) when it really was 0 (failure). #4242
99

10+
### Fixes
11+
- Do not return media from trashed messages in the "All media" view. #4247
12+
13+
1014
## [1.112.1] - 2023-03-27
1115

1216
### Changes

src/chat.rs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2727,12 +2727,14 @@ pub async fn get_chat_media(
27272727
"SELECT id
27282728
FROM msgs
27292729
WHERE (1=? OR chat_id=?)
2730+
AND chat_id != ?
27302731
AND (type=? OR type=? OR type=?)
27312732
AND hidden=0
27322733
ORDER BY timestamp, id;",
27332734
paramsv![
27342735
chat_id.is_none(),
27352736
chat_id.unwrap_or_else(|| ChatId::new(0)),
2737+
DC_CHAT_ID_TRASH,
27362738
msg_type,
27372739
if msg_type2 != Viewtype::Unknown {
27382740
msg_type2
@@ -3795,6 +3797,7 @@ mod tests {
37953797
use crate::chatlist::{get_archived_cnt, Chatlist};
37963798
use crate::constants::{DC_GCL_ARCHIVED_ONLY, DC_GCL_NO_SPECIALS};
37973799
use crate::contact::{Contact, ContactAddress};
3800+
use crate::message::delete_msgs;
37983801
use crate::receive_imf::receive_imf;
37993802
use crate::test_utils::TestContext;
38003803

@@ -5977,7 +5980,7 @@ mod tests {
59775980
include_bytes!("../test-data/image/avatar64x64.png"),
59785981
)
59795982
.await?;
5980-
send_media(
5983+
let second_image_msg_id = send_media(
59815984
&t,
59825985
chat_id2,
59835986
Viewtype::Image,
@@ -6079,6 +6082,21 @@ mod tests {
60796082
4
60806083
);
60816084

6085+
// Delete an image.
6086+
delete_msgs(&t, &[second_image_msg_id]).await?;
6087+
assert_eq!(
6088+
get_chat_media(
6089+
&t,
6090+
None,
6091+
Viewtype::Image,
6092+
Viewtype::Sticker,
6093+
Viewtype::Webxdc,
6094+
)
6095+
.await?
6096+
.len(),
6097+
3
6098+
);
6099+
60826100
Ok(())
60836101
}
60846102
}

0 commit comments

Comments
 (0)