mirror of
https://github.com/chatmail/core.git
synced 2026-04-28 10:56:29 +03:00
add test, fix and high level python api for dc_delete_contact
the rust-logic was inverted -- you can not delete a contact that still has messages with it.
This commit is contained in:
@@ -796,7 +796,7 @@ pub fn dc_delete_contact(context: &Context, contact_id: u32) -> bool {
|
||||
0
|
||||
};
|
||||
|
||||
if count_msgs > 0 {
|
||||
if count_msgs == 0 {
|
||||
if sql::execute(
|
||||
context,
|
||||
&context.sql,
|
||||
@@ -808,9 +808,14 @@ pub fn dc_delete_contact(context: &Context, contact_id: u32) -> bool {
|
||||
context.call_cb(Event::CONTACTS_CHANGED, 0, 0);
|
||||
true
|
||||
} else {
|
||||
error!(context, 0, "delete_contact {} failed", contact_id);
|
||||
false
|
||||
}
|
||||
} else {
|
||||
info!(
|
||||
context,
|
||||
0, "could not delete contact {}, there are {} messages with it", contact_id, count_msgs
|
||||
);
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user