Skip to content

fix(mobile): resolve hand-typed member mentions at send time - #4309

Open
technicallybrantley wants to merge 1 commit into
block:mainfrom
technicallybrantley:fix/mobile-typed-mention-extraction
Open

fix(mobile): resolve hand-typed member mentions at send time#4309
technicallybrantley wants to merge 1 commit into
block:mainfrom
technicallybrantley:fix/mobile-typed-mention-extraction

Conversation

@technicallybrantley

Copy link
Copy Markdown
Contributor

Summary

On mobile, a hand-typed @name mention went out as plain text — no p tag, no notification — unless the name was tapped in the suggestion popup. The composer only collected mentions from the picker-populated map, while desktop already resolves typed mentions at send time (extractMentionPubkeys in useMentions.ts).

This mirrors that member scan in the mobile composer: after collecting picker-selected mentions, remaining channel-member display names are matched against the outgoing text with the existing hasMention matcher. Picker selections keep precedence for a name, and the scan is members-only, so it can never trigger the non-member invite prompt on its own. The scan lives in compose_bar/helpers.dart to keep compose_bar.dart under the mobile file-size ratchet.

Related issue

None found for this bug. Desktop's equivalent gap was fixed in #3991; adjacent autocomplete-discovery issues (#4187, #4128, #3971, #2508) do not cover send-time extraction of typed mentions on mobile.

Testing

  • New widget test types a member mention without touching the suggestion list and asserts the pubkey reaches onSend.
  • Locally (Flutter 3.41.7): dart format clean, flutter analyze clean, mobile file-size ratchet clean, full mobile suite green except one pre-existing failure (channel_detail_page_test.dart follow-mode) that fails identically on the untouched base commit.
  • Manual: on a debug build, type "@ hi" without tapping the popup and send — the recipient gets the mention notification and the raw event carries their p tag.
  • No UI changes — the composer renders identically; only the outgoing event's tags change, so no screenshots.

The mobile composer only collected mention pubkeys from the map populated
when a suggestion is tapped (insertMention), so a mention typed by hand —
never selected from the suggestion list — went out as plain text: no p
tag, no notification, silently. Desktop already handles this case:
extractMentionPubkeys in useMentions.ts scans the outgoing text against
channel-member candidates at send time.

Mirror that member scan at send time: _selectedMentionCandidates (in
compose_bar/helpers.dart, keeping compose_bar.dart under the mobile
file-size ratchet) collects picker-selected mentions, then matches
remaining channel-member display names against the text with the
existing hasMention matcher. Suggestion picks keep precedence for a
name, and the scan is members-only, so it can never trigger the
non-member invite prompt on its own.

Adds a widget test that types a member mention without touching the
suggestion list and asserts the pubkey reaches onSend.

Duplicate search: no existing PR or issue covers send-time extraction of
typed mentions on mobile. Desktop's equivalent gap was fixed in block#3991;
adjacent autocomplete-discovery issues (block#4187, block#4128, block#3971, block#2508) do
not cover this.

No UI changes — the composer renders identically; only the outgoing
event's tags change. Screenshots not applicable.

Manual test: on a debug build, type '@<member name> hi' into a channel
composer without tapping the suggestion popup and send; the recipient
now gets a mention notification and the raw event carries their p tag.

Local validation (Flutter 3.41.7, Windows): dart format clean, analyzer
clean, mobile file-size ratchet clean, mobile suite green except one
failure in channel_detail_page_test.dart (follow-mode) that fails
identically on the untouched base commit and is unrelated.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: technicallybrantley <bprice23@outlook.com>
Signed-off-by: technicallybrantley <bprice23@outlook.com>
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