Repository navigation
Conversation
Tiny Code Reviewthe AI provider rate-limited the request This is advice, not a gate. Re-run with the |
unRekable
left a comment
There was a problem hiding this comment.
Code Review
🟡 1 finding (1 blocking).
Telegram gains a working Block (a second block unblocks, since RelateAction has no Unblock), contact add and remove, the blocked list read at sign-on, and updatePeerBlocked applied live. The state design holds: the blocked set lives in the per-connection Live, is rebuilt from contacts.getBlocked at sign-on and kept right by updates, and unknown state falls on the safe side. The defect is in Add: it hard-codes add_phone_privacy_exception, which puts the person on the user's phone-privacy exception list, so Telegram shows them the user's phone number from then on - the user never asked for that, and removing the contact later does not revoke it.
Residual risk
- Past 500 blocked people the sign-on load stops (offset >= 500), so there the toggle infers the direction; it errs toward sending contacts.block, which Telegram keeps idempotent, so a block press cannot silently unblock someone whose state is unknown.
- info.rs marks blocked one way only (userFull.blocked true); a person unblocked on another device while an updatePeerBlocked is lost in flight stays marked until the next reconnect rebuilds the set.
- Re-adding a blocked person with Add flips their store relation to Contact while the block still stands on the network; the Blocked mark only returns at the next sign-on.
| let known = account.dir().get(who).cloned().unwrap_or_default(); | ||
| let (first_name, last_name) = split_name(&known.name); | ||
| let answer = account.ask(&tl::functions::contacts::AddContact { | ||
| add_phone_privacy_exception: true, |
There was a problem hiding this comment.
🔴 Blocker: This flag grants the added person lasting visibility of the user's phone number: Telegram's docs say to set it only when the user wishes to share it (first-party clients make it an explicit unchecked choice, and set it only when peerSettings.need_contacts_exception asks). Hard-coded true shares it on every Add, and contacts.deleteContacts does not undo the exception. Send false and leave the user's privacy setting as it is.
| add_phone_privacy_exception: true, | |
| add_phone_privacy_exception: false, |
01e2cc0 to
81ea280
Compare
81ea280 to
901bb3a
Compare
What changed and why
Block on a Telegram person now calls contacts.block and the person reads as blocked. Blocking someone who is already blocked calls contacts.unblock. Add and remove call contacts.addContact and contacts.deleteContacts. The blocked list is read at sign-on, and a block that arrives later is applied, without replacing the contact list.
Type
Platforms
Proof
Scenario: e2e/scenarios/telegram-block-contact
Lab run:
Compatibility
No protocol change. An older client still has no unblock action, so a second block is what clears a block here. Friend requests are unchanged because Telegram has none.
Risk and rollback
A wrong block would hide that person from the contact list until they are unblocked. Revert this change.
Release note
Block, add and remove work for a Telegram contact, and a blocked person reads as blocked.
Tested with
cargo test -p chatd --no-default-featureson the scripted block, add, remove and block update, and withcargo clippy -p chatd --no-default-features --all-targets. No live Telegram account. The lab was not run.Closes #487