diff --git a/src/chat.rs b/src/chat.rs index 1001e2102..35d03b836 100644 --- a/src/chat.rs +++ b/src/chat.rs @@ -252,7 +252,7 @@ impl ChatId { let chat_id = match ChatIdBlocked::lookup_by_contact(context, contact_id).await? { Some(chat) => { if create_blocked == Blocked::Not && chat.blocked != Blocked::Not { - chat.id.unblock_ex(context, Nosync).await?; + chat.id.set_blocked(context, Blocked::Not).await?; } chat.id } @@ -1903,6 +1903,7 @@ impl Chat { context .add_sync_item(SyncData::AlterChat { id, action }) .await?; + context.send_sync_msg().await?; } Ok(()) } diff --git a/src/contact.rs b/src/contact.rs index 750b7a762..f375123a3 100644 --- a/src/contact.rs +++ b/src/contact.rs @@ -1466,6 +1466,7 @@ WHERE type=? AND id IN ( action, }) .await?; + context.send_sync_msg().await?; } } diff --git a/src/sync.rs b/src/sync.rs index 9e7de104b..a078e42d8 100644 --- a/src/sync.rs +++ b/src/sync.rs @@ -78,6 +78,9 @@ pub(crate) struct SyncItems { impl Context { /// Adds an item to the list of items that should be synchronized to other devices. + /// + /// NB: Private and `pub(crate)` functions shouldn't call this unless `Sync::Sync` is explicitly + /// passed to them. This way it's always clear whether the code performs synchronisation. pub(crate) async fn add_sync_item(&self, data: SyncData) -> Result<()> { self.add_sync_item_with_timestamp(data, time()).await } @@ -584,9 +587,8 @@ mod tests { alices[1].recv_msg(&sent_msg).await; async fn sync(alices: &[TestContext]) -> Result<()> { - alices.get(0).unwrap().send_sync_msg().await?.unwrap(); - let sent_msg = alices.get(0).unwrap().pop_sent_msg().await; - alices.get(1).unwrap().recv_msg(&sent_msg).await; + let sync_msg = alices.get(0).unwrap().pop_sent_msg().await; + alices.get(1).unwrap().recv_msg(&sync_msg).await; Ok(()) }