feat: ChatId::create_for_contact_with_blocked: Don't emit events on no op

This commit is contained in:
iequidoo
2024-08-23 23:18:03 -03:00
committed by iequidoo
parent 418dfbf994
commit 853e38e054

View File

@@ -279,9 +279,10 @@ impl ChatId {
) -> Result<Self> {
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 => {