mirror of
https://github.com/block/buzz.git
synced 2026-08-18 06:50:31 +02:00
Editing a message to add an @mention never notified the newly-mentioned party. build_message_edit (kind 40003) emitted h/e/imeta/emoji tags but no `p` tags at all — the send path's mention_tags(mentions) was simply omitted from the edit path, so no mention-filtered subscription (e.g. the ACP agent harness) ever saw the added mention. Emit `p` tags for newly-added mentions ONLY. The composer diffs the edited body's resolved mentions against the original body's (both via the same channel-roster resolver the send path uses) and passes just the added set down through the edit command into build_message_edit. A typo-fix edit that leaves the mention set unchanged emits zero `p` tags and re-wakes nobody. Plumbing threads one new arg per layer: build_message_edit(mentions), edit_message(mention_pubkeys), editMessage/useEditMessageMutation (mentionPubkeys), handleEditSave + the onEditSave signature. The diff lives in a pure threading.ts helper (diffAddedMentionPubkeys) next to normalizeMentionPubkeys — lowercase/dedup/self-scrub, case-insensitive comparison so a case-only difference is never treated as newly added. Tests: events.rs pins the builder contract (added -> `p` tag, unchanged -> none, dedup+lowercase); diffAddedMentionPubkeys.test.mjs covers the diff both ways plus self-scrub, case-only no-op, remove/re-add. check-file-sizes.mjs: MessageComposer.tsx limit ratcheted 1091 -> 1114 (+23, load-bearing composer-side wiring; diff logic lives in threading.ts), matching the file's existing per-lane ratchet convention. Co-authored-by: Tyler <109685178+tlongwell-block@users.noreply.github.com> Signed-off-by: Tyler <109685178+tlongwell-block@users.noreply.github.com>