messaging: polish built-in behaviour — resolution, send, sort, race #59

Merged
zaelgohary merged 3 commits from development_fix_message_sender_name into development 2026-04-20 07:04:38 +00:00
Member

Summary

Eleven fixes in the messaging archipelago so the built-in UI actually renders and behaves the way the code already implies. No new features.

Resolution / display

# Fix
#58 Sender bubbles show the contact's name (or the raw public key as last resort) instead of the server's internal "Message in <sid>" identifier.
#60 Unnamed groups synthesize "Alice, Bob, Carol (+N more)" from contacts when the stored value is the "New Chat" placeholder.
#61 Dummy "system" key is filtered out of synthesized chat names.
#65 Chat detail header re-resolves for just-created groups (previously stuck on "New Chat" until reload).
#70 Chat header now re-resolves at render time so deep-linked chats update once contacts arrive — no wasted refetch of conversation or messages.

Send / input

# Fix
#62 Own sent messages render right-aligned with Me (works around the server still stamping sender_public_key = "system" pre-auth).
#63 Send failures surface via the existing error signal as an inline banner above the input.
#64 Input is disabled while a send is in flight so Enter-spam doesn't produce duplicates.
#71 sending flag is cleared on chat switch so a mid-send change-of-chat doesn't leave the new input locked.

List ordering / perf

# Fix
#66 Chat list is sorted latest-activity-first.
#72 fetch_contacts parallelized with futures::future::join_all, matching the fetch_chats / fetch_messages pattern.

Key changes

  • resolve_chat_display_name (service): group placeholder → participant list, "system" / self filtering.
  • New private helper resolve_contact_display_name(key, contacts) -> Option<String> — single source of truth for the pubkey → alias/name lookup.
  • New resolve_sender_name — thin wrapper for message-bubble senders.
  • chatmessage_to_messagedata now takes &[Contact] and uses the resolver.
  • ChatData carries raw_name + participant_keys so the header can re-resolve at render time.
  • ChatView gains error / sending props, renders an inline error banner, and forwards disabled to ChatInput.
  • NEW_CHAT_PLACEHOLDER / SYSTEM_KEY hoisted to named constants.

Test plan

  • cargo check -p hero_archipelagos_messaging green against merged hero_osis
  • rustfmt --edition 2021 --check on all modified files
  • End-to-end regression: tests/e2e/messaging.spec.ts in hero_os passes against the deployed archipelago (3 RPCs per chat open, resolved names in list + header, optimistic-own rendering, auto-scroll, list preview updates on send, no stale-flash on switch, NewChat + adds a chip).

Closes #58, #60, #61, #62, #63, #64, #65, #66, #70, #71, #72.

## Summary Eleven fixes in the messaging archipelago so the built-in UI actually renders and behaves the way the code already implies. No new features. ### Resolution / display | # | Fix | |---|---| | #58 | Sender bubbles show the contact's name (or the raw public key as last resort) instead of the server's internal `"Message in <sid>"` identifier. | | #60 | Unnamed groups synthesize `"Alice, Bob, Carol (+N more)"` from contacts when the stored value is the `"New Chat"` placeholder. | | #61 | Dummy `"system"` key is filtered out of synthesized chat names. | | #65 | Chat detail header re-resolves for just-created groups (previously stuck on `"New Chat"` until reload). | | #70 | Chat header now re-resolves at render time so deep-linked chats update once contacts arrive — no wasted refetch of conversation or messages. | ### Send / input | # | Fix | |---|---| | #62 | Own sent messages render right-aligned with `Me` (works around the server still stamping `sender_public_key = "system"` pre-auth). | | #63 | Send failures surface via the existing `error` signal as an inline banner above the input. | | #64 | Input is disabled while a send is in flight so Enter-spam doesn't produce duplicates. | | #71 | `sending` flag is cleared on chat switch so a mid-send change-of-chat doesn't leave the new input locked. | ### List ordering / perf | # | Fix | |---|---| | #66 | Chat list is sorted latest-activity-first. | | #72 | `fetch_contacts` parallelized with `futures::future::join_all`, matching the `fetch_chats` / `fetch_messages` pattern. | ## Key changes - `resolve_chat_display_name` (service): group placeholder → participant list, `"system"` / self filtering. - New private helper `resolve_contact_display_name(key, contacts) -> Option<String>` — single source of truth for the pubkey → alias/name lookup. - New `resolve_sender_name` — thin wrapper for message-bubble senders. - `chatmessage_to_messagedata` now takes `&[Contact]` and uses the resolver. - `ChatData` carries `raw_name` + `participant_keys` so the header can re-resolve at render time. - `ChatView` gains `error` / `sending` props, renders an inline error banner, and forwards `disabled` to `ChatInput`. - `NEW_CHAT_PLACEHOLDER` / `SYSTEM_KEY` hoisted to named constants. ## Test plan - [x] `cargo check -p hero_archipelagos_messaging` green against merged hero_osis - [x] `rustfmt --edition 2021 --check` on all modified files - [x] End-to-end regression: `tests/e2e/messaging.spec.ts` in hero_os passes against the deployed archipelago (3 RPCs per chat open, resolved names in list + header, optimistic-own rendering, auto-scroll, list preview updates on send, no stale-flash on switch, NewChat `+` adds a chip). Closes #58, #60, #61, #62, #63, #64, #65, #66, #70, #71, #72.
messaging: resolve sender name from contacts, not internal ChatMessage.name
Some checks failed
Build and Test / build (pull_request) Failing after 7s
6002f78da8
Bubble sender labels showed "Message in <conv_sid>" — the server-side
internal identifier (`ChatMessage.name = format!("Message in {}", ...)`),
which `chatmessage_to_messagedata` was using as `sender_name` for
non-own messages.

Adds `resolve_sender_name(sender_public_key, own_user_key, contacts)`
mirroring the DM-name resolver; threaded through both call sites in
the archipelago (initial load + optimistic send push). Falls back to
the raw public key when no contact matches.

Closes #58
messaging: polish group names, own-message rendering, send-error surfacing, input lock
Some checks failed
Build and Test / build (pull_request) Failing after 7s
1e0a2921d0
zaelgohary changed title from messaging: resolve sender name from contacts to messaging: polish built-in features (sender, groups, own messages, errors, input lock) 2026-04-19 10:57:59 +00:00
- handle_create now passes an empty Route name so the chat-load effect
  resolves against contacts instead of rendering the raw `"New Chat"`
  placeholder in the chat header (#65).
- Chat list is now sorted latest-message-first, pushing chats without
  a timestamp to the bottom (#66).
- Chat header re-resolves its display name at render time, so a
  deep-link that lands before contacts arrive updates as soon as they
  do — without re-fetching the conversation or re-listing its
  messages (#70). `ChatData` gains `raw_name` + `participant_keys`
  to support this.
- `handle_chat_click` resets the `sending` flag so a chat-switch
  mid-send doesn't leave the new chat's input disabled (#71).
- `fetch_contacts` is parallelized with `futures::future::join_all`,
  matching the existing `fetch_chats` / `fetch_messages` pattern (#72).

Service-layer cleanup along the way:
- `NEW_CHAT_PLACEHOLDER` / `SYSTEM_KEY` extracted as named constants.
- `resolve_contact_display_name` (new, private) returns `Option<String>`
  so the "no contact matched" signal is explicit instead of relying on
  string equality with the input key.
- `resolve_chat_display_name` and `resolve_sender_name` now share that
  lookup.
zaelgohary changed title from messaging: polish built-in features (sender, groups, own messages, errors, input lock) to messaging: polish built-in behaviour — resolution, send, sort, race 2026-04-20 06:50:50 +00:00
zaelgohary merged commit 10e5e7f1c1 into development 2026-04-20 07:04:38 +00:00
zaelgohary deleted branch development_fix_message_sender_name 2026-04-20 07:09:56 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lhumina_code/hero_archipelagos!59
No description provided.