chatlist: hide all expired messages before loading

This commit is contained in:
Alexander Krotov
2020-03-28 21:58:46 +03:00
parent 2bf4c5d7e7
commit 3686048ab6
2 changed files with 24 additions and 0 deletions

View File

@@ -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,

View File

@@ -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| {