Skip to content

feat(cli): resolve @everyone / @channel to all channel members - #4777

Open
alisqr wants to merge 1 commit into
block:mainfrom
alisqr:feat/everyone-channel-mention
Open

feat(cli): resolve @everyone / @channel to all channel members#4777
alisqr wants to merge 1 commit into
block:mainfrom
alisqr:feat/everyone-channel-mention

Conversation

@alisqr

@alisqr alisqr commented Aug 4, 2026

Copy link
Copy Markdown

What

Adds a first-class @everyone / @channel broadcast keyword to buzz messages send. Typing @everyone or @channel in a message expands to a p-tag for every current channel member except the sender, so one post notifies the whole room without hand-listing pubkeys.

Motivation: users kept asking "is there a way to tag everyone at once?" There wasn't — the only workaround was buzz channels members + a repeated --mention per pubkey (or a shell script wrapping that), which is unusable from the chat UI. This makes the natural thing work.

How

buzz-sdk (mentions.rs) — two pure, network-free helpers alongside the existing mention pipeline:

  • contains_everyone_keyword(content) — detects @everyone / @channel, case-insensitive, using the same boundary rules as ordinary @mention: the @ must be at start-of-input or preceded by ASCII whitespace, and the keyword must be followed by a word boundary (whitespace / common punctuation / end-of-input). Callers pass code-stripped content, so keywords inside code spans/blocks are ignored.
  • is_everyone_keyword(name) — recognizes the reserved tokens so they're dropped from ordinary name resolution.
  • @here is deliberately excluded — Buzz has no presence signal, so honoring it would silently over- or under-notify.

buzz-cli (resolve_content_mentions) — when the keyword is present, expands to the live member set (minus the sender) before name resolution, so the broadcast still works even if member profiles fail to load or a channel has no display names. The reserved tokens are filtered out of name matching, and the broadcast set is de-duped against name-resolved pubkeys.

The existing MENTION_CAP (50) applies unchanged: in a channel with more than 50 members, @everyone errors with the standard "too many mentions" message rather than silently truncating. Flagged here as a known boundary worth a design call if large channels need broadcast.

Tests

7 new unit tests in buzz-sdk: basic forms, case-insensitivity, trailing word-boundary, leading-boundary rule (email-like [email protected] does not trigger), multibyte-safety (no panic), and @here exclusion.

  • cargo test -p buzz-sdk: 259 passed / 0 failed
  • cargo test -p buzz-cli: 317 passed / 0 failed
  • cargo clippy -p buzz-sdk -p buzz-cli --all-targets: clean
  • cargo fmt: applied

Notes

Originated from a request in the Buzz Welcome channel. Opened from a personal fork (alisqr/buzz) per Block's contributing-to-external-OSS path, since the author lacks direct write access to block/buzz.

Adds a first-class broadcast keyword to buzz messages send. Typing
`@everyone` or `@channel` (case-insensitive, word-boundary matched)
expands to a p-tag for every current channel member except the sender,
so one post notifies the whole room without listing pubkeys by hand.

- buzz-sdk: pure `contains_everyone_keyword` / `is_everyone_keyword`
  helpers alongside the existing mention pipeline, following the same
  leading-whitespace and trailing word-boundary rules as `@mention`
  and skipping code regions. `@here` is deliberately excluded (Buzz
  has no presence signal to honor it).
- buzz-cli: resolve_content_mentions expands the keyword to the live
  member set before name resolution (so it works even if profiles are
  missing), drops the reserved tokens from ordinary name matching, and
  de-dupes against name-resolved pubkeys. The existing MENTION_CAP (50)
  still applies unchanged.
- 7 new unit tests cover case-insensitivity, word boundaries, the
  leading-boundary rule, multibyte safety, and \@here exclusion.

Co-authored-by: Ali Rossi <[email protected]>
Signed-off-by: Ali Rossi <[email protected]>
@alisqr
alisqr requested a review from a team as a code owner August 4, 2026 20:09
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.

1 participant