mirror of
https://github.com/chatmail/core.git
synced 2026-04-29 03:16:29 +03:00
chatlist: hide all expired messages before loading
This commit is contained in:
22
src/chat.rs
22
src/chat.rs
@@ -1630,6 +1630,28 @@ pub fn marknoticed_all_chats(context: &Context) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn delete_device_expired_messages_all_chats(context: &Context) -> Result<(), Error> {
|
||||
let chat_ids = context.sql.query_map(
|
||||
"SELECT id FROM chats WHERE id > 9",
|
||||
params![],
|
||||
|row| row.get::<_, ChatId>(0),
|
||||
|ids| {
|
||||
let mut ret = Vec::new();
|
||||
for id in ids {
|
||||
if let Ok(chat_id) = id {
|
||||
ret.push(chat_id)
|
||||
}
|
||||
}
|
||||
Ok(ret)
|
||||
},
|
||||
)?;
|
||||
|
||||
for chat_id in chat_ids {
|
||||
chat_id.delete_device_expired_messages(context)?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn get_chat_media(
|
||||
context: &Context,
|
||||
chat_id: ChatId,
|
||||
|
||||
@@ -92,6 +92,8 @@ impl Chatlist {
|
||||
query: Option<&str>,
|
||||
query_contact_id: Option<u32>,
|
||||
) -> Result<Self> {
|
||||
delete_device_expired_messages_all_chats(context)?;
|
||||
|
||||
let mut add_archived_link_item = false;
|
||||
|
||||
let process_row = |row: &rusqlite::Row| {
|
||||
|
||||
Reference in New Issue
Block a user