mirror of
https://github.com/block/buzz.git
synced 2026-08-18 06:50:31 +02:00
buzz users presence misidentified who is online: the relay's /query bridge intercepts presence filters and synthesizes relay-signed kind:20001 events (bridge.rs synthesize_presence) with the subject in the p tag, but cmd_get_presence mapped event.pubkey — the relay keypair — so every row reported the relay signer's pubkey. Extract the row mapping into map_presence_events, which reports the p-tag subject when present and falls back to the event author otherwise. The fallback keeps real user-signed kind:20001 updates correct (build_presence_update emits no p tag — the author is the subject there) and guards against a malformed bare ["p"] tag blanking the pubkey. Regression tests cover all three shapes: synthesized (p-tag subject wins over the relay signer), user-signed (author reported), and malformed p tag (author fallback). Tested: cargo test -p buzz-cli --lib (149 passed, incl. the 3 new tests), cargo clippy -p buzz-cli --all-targets -D warnings, cargo fmt --check. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: Matt Toohey <contact@matttoohey.com>