feat(cli): resolve @everyone / @channel to all channel members - #4777
Open
alisqr wants to merge 1 commit into
Open
feat(cli): resolve @everyone / @channel to all channel members#4777alisqr wants to merge 1 commit into
alisqr wants to merge 1 commit into
Conversation
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]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a first-class
@everyone/@channelbroadcast keyword tobuzz messages send. Typing@everyoneor@channelin a message expands to ap-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--mentionper 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.@hereis 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,@everyoneerrors 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@hereexclusion.cargo test -p buzz-sdk: 259 passed / 0 failedcargo test -p buzz-cli: 317 passed / 0 failedcargo clippy -p buzz-sdk -p buzz-cli --all-targets: cleancargo fmt: appliedNotes
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 toblock/buzz.