Skip to content

Commit 73bf698

Browse files
committed
fix: do not add QR inviter to groups immediately
By the time you scan the QR code, inviter may not be in the group already. In this case securejoin protocol will never complete. If you then join the group in some other way, this results in you implicitly adding that inviter to the group.
1 parent aaa0f8e commit 73bf698

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

src/receive_imf.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2841,6 +2841,16 @@ async fn apply_group_changes(
28412841
if !is_from_in_chat {
28422842
better_msg = Some(String::new());
28432843
} else if let Some(key) = mime_parser.gossiped_keys.get(added_addr) {
2844+
if !chat_contacts.contains(&from_id) {
2845+
chat::add_to_chat_contacts_table(
2846+
context,
2847+
mime_parser.timestamp_sent,
2848+
chat.id,
2849+
&[from_id],
2850+
)
2851+
.await?;
2852+
}
2853+
28442854
// TODO: if gossiped keys contain the same address multiple times,
28452855
// we may lookup the wrong contact.
28462856
// This can be fixed by looking at ChatGroupMemberAddedFpr,

src/securejoin/bob.rs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -126,17 +126,6 @@ pub(super) async fn start_protocol(context: &Context, invite: QrInvite) -> Resul
126126
match invite {
127127
QrInvite::Group { .. } => {
128128
let joining_chat_id = joining_chat_id(context, &invite, private_chat_id).await?;
129-
// We created the group already, now we need to add Alice to the group.
130-
// The group will only become usable once the protocol is finished.
131-
if !is_contact_in_chat(context, joining_chat_id, invite.contact_id()).await? {
132-
chat::add_to_chat_contacts_table(
133-
context,
134-
time(),
135-
joining_chat_id,
136-
&[invite.contact_id()],
137-
)
138-
.await?;
139-
}
140129
let msg = stock_str::secure_join_started(context, invite.contact_id()).await;
141130
chat::add_info_msg(context, joining_chat_id, &msg, time()).await?;
142131
Ok(joining_chat_id)

0 commit comments

Comments
 (0)