diff --git a/python/tests/test_account.py b/python/tests/test_account.py index d807f1ac4..f9f3c24e2 100644 --- a/python/tests/test_account.py +++ b/python/tests/test_account.py @@ -1750,6 +1750,8 @@ class TestOnlineAccount: # Explicitly rename contact on ac2 to "Renamed" ac2.create_contact(contact, name="Renamed") assert contact.name == "Renamed" + ev = ac2._evtracker.get_matching("DC_EVENT_CONTACTS_CHANGED") + assert ev.data1 == contact.id # ac1 also renames itself into "Renamed" assert update_name() == "Renamed" diff --git a/src/contact.rs b/src/contact.rs index c557496e0..678f52cee 100644 --- a/src/contact.rs +++ b/src/contact.rs @@ -247,13 +247,12 @@ impl Contact { let (contact_id, sth_modified) = Contact::add_or_lookup(context, name, addr, Origin::ManuallyCreated).await?; let blocked = Contact::is_blocked_load(context, contact_id).await; - context.emit_event(EventType::ContactsChanged( - if sth_modified == Modifier::Created { - Some(contact_id) - } else { - None - }, - )); + match sth_modified { + Modifier::None => {} + Modifier::Modified | Modifier::Created => { + context.emit_event(EventType::ContactsChanged(Some(contact_id))) + } + } if blocked { Contact::unblock(context, contact_id).await; }