mirror of
https://github.com/chatmail/core.git
synced 2026-04-02 05:22:14 +03:00
Set contact ID in ContactsChanged on modification
This commit is contained in:
committed by
link2xt
parent
332a387c98
commit
fe1c99c5e8
@@ -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"
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user