Refactor hiding of expired messages

Now there is only one function: hide_device_expired_messages().

If any messages are hidden event DC_EVENT_MSGS_CHANGED(0,0) is emitted
now, which is more correct than DC_EVENT_CHAT_MODIFIED and also triggers
chatlist reload.
This commit is contained in:
Alexander Krotov
2020-03-28 23:29:15 +03:00
parent 7522fec044
commit fc57cbfb49
2 changed files with 41 additions and 53 deletions

View File

@@ -92,7 +92,9 @@ impl Chatlist {
query: Option<&str>,
query_contact_id: Option<u32>,
) -> Result<Self> {
delete_device_expired_messages_all_chats(context)?;
// Note that we do not emit DC_EVENT_MSGS_MODIFIED here even if some
// messages get hidden to avoid reloading the same chatlist.
hide_device_expired_messages(context)?;
let mut add_archived_link_item = false;