melib/jmap: fix mailbox children relationships being ignored

lazy_fetch
Manos Pitsidianakis 2021-01-08 15:22:41 +02:00
parent 622ded8021
commit 2f47f1eebd
Signed by: Manos Pitsidianakis
GPG Key ID: 73627C2F690DF710
1 changed files with 8 additions and 2 deletions

View File

@ -109,7 +109,7 @@ pub async fn get_mailboxes(conn: &JmapConnection) -> Result<HashMap<MailboxHash,
list, account_id, ..
} = m;
*conn.store.account_id.lock().unwrap() = account_id;
Ok(list
let mut ret: HashMap<MailboxHash, JmapMailbox> = list
.into_iter()
.map(|r| {
let MailboxObject {
@ -157,7 +157,13 @@ pub async fn get_mailboxes(conn: &JmapConnection) -> Result<HashMap<MailboxHash,
},
)
})
.collect())
.collect();
for key in ret.keys().cloned().collect::<SmallVec<[MailboxHash; 24]>>() {
if let Some(parent_hash) = ret[&key].parent_hash.clone() {
ret.entry(parent_hash).and_modify(|e| e.children.push(key));
}
}
Ok(ret)
}
pub async fn get_message_list(