diff --git a/src/chat.rs b/src/chat.rs index 378456819..c131fd1e9 100644 --- a/src/chat.rs +++ b/src/chat.rs @@ -918,9 +918,10 @@ impl ChatId { .sql .query_map( "SELECT chat_id, count(*) AS n - FROM chats_contacts where contact_id > 9 + FROM chats_contacts + WHERE contact_id > ? AND chat_id > ? GROUP BY chat_id", - (), + (ContactId::LAST_SPECIAL, DC_CHAT_ID_LAST_SPECIAL), |row| { let chat_id: ChatId = row.get(0)?; let size: f64 = row.get(1)?; diff --git a/src/contact.rs b/src/contact.rs index 2af80c147..e57fc39bf 100644 --- a/src/contact.rs +++ b/src/contact.rs @@ -109,7 +109,7 @@ impl ContactId { /// ID of the contact for device messages. pub const DEVICE: ContactId = ContactId::new(5); - const LAST_SPECIAL: ContactId = ContactId::new(9); + pub(crate) const LAST_SPECIAL: ContactId = ContactId::new(9); /// Address to go with [`ContactId::DEVICE`]. ///