mirror of
https://github.com/chatmail/core.git
synced 2026-05-04 13:56:30 +03:00
Set contact ID in event related to contact blocking
This commit is contained in:
committed by
link2xt
parent
fe1c99c5e8
commit
97b1a1c392
@@ -1417,6 +1417,8 @@ class TestOnlineAccount:
|
|||||||
contact = ac1.create_contact(ac2)
|
contact = ac1.create_contact(ac2)
|
||||||
contact.set_blocked()
|
contact.set_blocked()
|
||||||
assert contact.is_blocked()
|
assert contact.is_blocked()
|
||||||
|
ev = ac1._evtracker.get_matching("DC_EVENT_CONTACTS_CHANGED")
|
||||||
|
assert ev.data1 == contact.id
|
||||||
|
|
||||||
lp.sec("ac2 sends a message to ac1 that does not arrive because it is blocked")
|
lp.sec("ac2 sends a message to ac1 that does not arrive because it is blocked")
|
||||||
ac2.create_chat(ac1).send_text("This will not arrive!")
|
ac2.create_chat(ac1).send_text("This will not arrive!")
|
||||||
|
|||||||
@@ -1090,12 +1090,12 @@ async fn set_block_contact(context: &Context, contact_id: u32, new_blocking: boo
|
|||||||
// However, I'm not sure about this point; it may be confusing if the user wants to add other people;
|
// However, I'm not sure about this point; it may be confusing if the user wants to add other people;
|
||||||
// this would result in recreating the same group...)
|
// this would result in recreating the same group...)
|
||||||
if context.sql.execute(
|
if context.sql.execute(
|
||||||
"UPDATE chats SET blocked=? WHERE type=? AND id IN (SELECT chat_id FROM chats_contacts WHERE contact_id=?);",
|
"UPDATE chats SET blocked=? WHERE type=? AND id IN (SELECT chat_id FROM chats_contacts WHERE contact_id=?);",
|
||||||
paramsv![new_blocking, 100, contact_id as i32],
|
paramsv![new_blocking, 100, contact_id as i32]).await.is_ok()
|
||||||
).await.is_ok() {
|
{
|
||||||
Contact::mark_noticed(context, contact_id).await;
|
Contact::mark_noticed(context, contact_id).await;
|
||||||
context.emit_event(EventType::ContactsChanged(None));
|
context.emit_event(EventType::ContactsChanged(Some(contact_id)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user