Files
buzz/mobile/lib/shared
Matt Toohey 4e4ac3efd8 fix(mobile): fold accents when matching mention names
`@jos` listed José María, `@jose` listed nobody and `@josé` listed them
again: mobile only lowercased names. Name matching now follows section 3
of the shared mention rules, as buzz-app does (recommendation 6). Each
code point is NFKD-normalized, its combining accents (the Combining
Diacritical Marks blocks) are removed, it is lowercased and a final `ς`
becomes `σ`, so `jose` matches `José`, `fiona` matches `fio` and `jose`
matches `jose`, while `ø`, `ł`, `æ`, `ß`, `ı` and the marks of other
scripts stay distinct. Words are runs of letters, marks and digits, so a
hyphen or apostrophe separates them: `jane` finds `Mary-Jane` and `brien`
finds `O'Brien`. The folding lives in `name_match.dart` and drives the
chooser, Space selection, multi-word admission, the verified-name matches
and the recipient pickers, so `@jose maria` lists José María with no
accents typed.

The vendored fixture moves from version 1 (95 cases) to version 4 of
buzz-app's `mention-rules.fixtures.json` (125 cases), copied unchanged,
and the conformance test runs every section, with a new `matching` group.
No case is skipped. The rules the newer versions added are implemented
too: an exact public key (64 hex in either case, or a complete lowercase
or uppercase npub with an optional `nostr:` prefix) matches only its
owner, even one with no name, and Space selects that owner; the viewer's
own agent whose name continues the query with a new word leads (`Sol 6`
for `sol`), and an exact person leads over it; agents from the viewer's
other communities follow everyone here; an outside choice's longer name
no longer blocks a member's exact name on Space, and a choice's own longer
alias is not its own namesake.

The search cache's exact-key exemption uses the same `typedPublicKey`.
Refutation itself stays lowercase-only on purpose: it reasons about the
relay's prefix search, which is out of scope here, so an accented query
is a new search rather than a continuation. A refuted query still matches
members on the device by folding: after `z` finds nobody, `@zoe` lists
the member Zoë without a search.

Tests: the compose bar search journey types `@jose maria` and sees José
María, and `@zoe` after the `z` refutation sees Zoë; both and seven
fixture cases fail when accent stripping is removed. `dart format`,
`flutter analyze` and the full mobile `flutter test` suite pass.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Signed-off-by: Matt Toohey <contact@matttoohey.com>
2026-11-19 15:07:07 +11:00
..