From 853e38e05482c5f85eef2674eb4d4b2ff41f37bd Mon Sep 17 00:00:00 2001 From: iequidoo Date: Fri, 23 Aug 2024 23:18:03 -0300 Subject: [PATCH] feat: ChatId::create_for_contact_with_blocked: Don't emit events on no op --- src/chat.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/chat.rs b/src/chat.rs index a146a7432..de4be9f3e 100644 --- a/src/chat.rs +++ b/src/chat.rs @@ -279,9 +279,10 @@ impl ChatId { ) -> Result { 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.set_blocked(context, Blocked::Not).await?; + if create_blocked != Blocked::Not || chat.blocked == Blocked::Not { + return Ok(chat.id); } + chat.id.set_blocked(context, Blocked::Not).await?; chat.id } None => {