Reset group member list when we are added to the group

This makes test_synchronize_member_list_on_group_rejoin pass.
This commit is contained in:
Alexander Krotov
2020-03-18 03:23:22 +03:00
parent 9654802acc
commit e7e4821804
2 changed files with 11 additions and 2 deletions

View File

@@ -1438,8 +1438,6 @@ class TestGroupStressTests:
lp.sec("ac2: check that ac3 is removed")
msg = ac2.wait_next_incoming_message()
# ac2 did not see that ac3 was removed
# FIXME: due to a bug, ac2 thinks ac3 is still in the chat
assert len(msg.chat.get_contacts()) == len(chat.get_contacts())

View File

@@ -1023,6 +1023,17 @@ fn create_or_lookup_group(
// add members to group/check members
if recreate_member_list {
if !chat::is_contact_in_chat(context, chat_id, DC_CONTACT_ID_SELF) {
// Members could have been removed while we were
// absent. We can't use existing member list and need to
// start from scratch.
sql::execute(
context,
&context.sql,
"DELETE FROM chats_contacts WHERE chat_id=?;",
params![chat_id],
)
.ok();
chat::add_to_chat_contacts_table(context, chat_id, DC_CONTACT_ID_SELF);
}
if from_id > DC_CONTACT_ID_LAST_SPECIAL