Skip to content

Conversation

@Hocuri
Copy link
Collaborator

@Hocuri Hocuri commented Jan 14, 2026

This PR fixes a bug that old channel members were remembered in the database even after they left the channel. Concretely, they remained in the past_members table that's only meant for groups.

Though it was not a bad bug; we're anyways not cleaning up old contacts.

@Hocuri Hocuri requested a review from link2xt January 14, 2026 11:17
Comment on lines +250 to +274
} else if let Some(fp) = must_have_only_one_recipient(&msg, &chat) {
// In a broadcast channel, only send member-added/removed messages
// to the affected member
let (authname, addr, public_key_bytes) = context
.sql
.query_row(
"SELECT c.authname, c.addr, k.public_key
FROM contacts c, public_keys k
WHERE c.fingerprint=?1 AND k.fingerprint=?1",
(fp?,),
|row| {
let authname: String = row.get(0)?;
let addr: String = row.get(1)?;
let public_key_bytes: Vec<u8> = row.get(2)?;

Ok((authname, addr, public_key_bytes))
},
)
.await?;

recipients.push(addr.clone());
to.push((authname, addr.clone()));

let public_key = SignedPublicKey::from_slice(&public_key_bytes)?;
encryption_pubkeys = Some(vec![(addr, public_key)]);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is necessary because previously, the removed contact was loaded from the past_members table.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants