mirror of
https://github.com/chatmail/core.git
synced 2026-05-08 09:26:29 +03:00
Do not return media from trashed messages in the "All media" view.
This commit is contained in:
@@ -7,6 +7,10 @@
|
|||||||
- transfer backup: Connect to mutliple provider addresses concurrently. This should speed up connection time significantly on the getter side. #4240
|
- transfer backup: Connect to mutliple provider addresses concurrently. This should speed up connection time significantly on the getter side. #4240
|
||||||
- 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
|
- 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
|
||||||
|
|
||||||
|
### Fixes
|
||||||
|
- Do not return media from trashed messages in the "All media" view. #4247
|
||||||
|
|
||||||
|
|
||||||
## [1.112.1] - 2023-03-27
|
## [1.112.1] - 2023-03-27
|
||||||
|
|
||||||
### Changes
|
### Changes
|
||||||
|
|||||||
20
src/chat.rs
20
src/chat.rs
@@ -2727,12 +2727,14 @@ pub async fn get_chat_media(
|
|||||||
"SELECT id
|
"SELECT id
|
||||||
FROM msgs
|
FROM msgs
|
||||||
WHERE (1=? OR chat_id=?)
|
WHERE (1=? OR chat_id=?)
|
||||||
|
AND chat_id != ?
|
||||||
AND (type=? OR type=? OR type=?)
|
AND (type=? OR type=? OR type=?)
|
||||||
AND hidden=0
|
AND hidden=0
|
||||||
ORDER BY timestamp, id;",
|
ORDER BY timestamp, id;",
|
||||||
paramsv![
|
paramsv![
|
||||||
chat_id.is_none(),
|
chat_id.is_none(),
|
||||||
chat_id.unwrap_or_else(|| ChatId::new(0)),
|
chat_id.unwrap_or_else(|| ChatId::new(0)),
|
||||||
|
DC_CHAT_ID_TRASH,
|
||||||
msg_type,
|
msg_type,
|
||||||
if msg_type2 != Viewtype::Unknown {
|
if msg_type2 != Viewtype::Unknown {
|
||||||
msg_type2
|
msg_type2
|
||||||
@@ -3795,6 +3797,7 @@ mod tests {
|
|||||||
use crate::chatlist::{get_archived_cnt, Chatlist};
|
use crate::chatlist::{get_archived_cnt, Chatlist};
|
||||||
use crate::constants::{DC_GCL_ARCHIVED_ONLY, DC_GCL_NO_SPECIALS};
|
use crate::constants::{DC_GCL_ARCHIVED_ONLY, DC_GCL_NO_SPECIALS};
|
||||||
use crate::contact::{Contact, ContactAddress};
|
use crate::contact::{Contact, ContactAddress};
|
||||||
|
use crate::message::delete_msgs;
|
||||||
use crate::receive_imf::receive_imf;
|
use crate::receive_imf::receive_imf;
|
||||||
use crate::test_utils::TestContext;
|
use crate::test_utils::TestContext;
|
||||||
|
|
||||||
@@ -5977,7 +5980,7 @@ mod tests {
|
|||||||
include_bytes!("../test-data/image/avatar64x64.png"),
|
include_bytes!("../test-data/image/avatar64x64.png"),
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
send_media(
|
let second_image_msg_id = send_media(
|
||||||
&t,
|
&t,
|
||||||
chat_id2,
|
chat_id2,
|
||||||
Viewtype::Image,
|
Viewtype::Image,
|
||||||
@@ -6079,6 +6082,21 @@ mod tests {
|
|||||||
4
|
4
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Delete an image.
|
||||||
|
delete_msgs(&t, &[second_image_msg_id]).await?;
|
||||||
|
assert_eq!(
|
||||||
|
get_chat_media(
|
||||||
|
&t,
|
||||||
|
None,
|
||||||
|
Viewtype::Image,
|
||||||
|
Viewtype::Sticker,
|
||||||
|
Viewtype::Webxdc,
|
||||||
|
)
|
||||||
|
.await?
|
||||||
|
.len(),
|
||||||
|
3
|
||||||
|
);
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user