Skip to content

fix(ui): preserve nickname when re-adding pruned user#101

Merged
sanity merged 6 commits intomainfrom
fix-nickname-after-prune
Feb 15, 2026
Merged

fix(ui): preserve nickname when re-adding pruned user#101
sanity merged 6 commits intomainfrom
fix-nickname-after-prune

Conversation

@sanity
Copy link
Contributor

@sanity sanity commented Feb 15, 2026

Problem

When a user gets pruned for inactivity, post_apply_cleanup removes both their members entry and their member_info (which contains their nickname). When they send a new message and get re-added, the rejoin code hardcodes the nickname to "Member" — losing the user's actual display name.

Approach

Cache the user's AuthorizedMemberInfo in a new RoomData.self_member_info field (alongside the existing self_authorized_member). The capture method is renamed from capture_self_authorized_member to capture_self_membership_data and now always updates the cached member info to the latest version from room_state.member_info, so nickname edits are also preserved.

On rejoin, the stored self_member_info is used instead of constructing a new one with a hardcoded "Member" nickname. Falls back to the old behavior when no stored info exists (first-time members).

No delegate or contract changes needed — RoomData is serialized/deserialized by the UI, and the delegate stores opaque bytes. The new field uses #[serde(default)] for backward compatibility.

Testing

  • cargo test -p river-core — passes
  • cargo check -p river-ui --target wasm32-unknown-unknown --features no-sync — compiles (pre-existing WASM artifact errors in worktree only)

Files changed

  • ui/src/room_data.rs — add self_member_info field, rename and extend capture method
  • ui/src/components/conversation.rs — use stored info in rejoin delta
  • ui/src/components/app/freenet_api/response_handler/get_response.rs — update struct literal and method call
  • ui/src/example_data.rs — update struct literal

[AI-assisted - Claude]

sanity and others added 6 commits February 14, 2026 21:24
The publish-river-test pipeline was broken - it published the production-pathed
archive to a test contract, so assets never loaded. Add compress-webapp-test
task that replaces the hardcoded production contract ID with the test contract
ID via binary find-and-replace, and update sign/publish tasks to use it.

Also remove unused RIVER_BASE_PATH env var from build-ui.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Rebuild room_contract.wasm to include post_apply_cleanup member pruning
from commit 58ab2e7. The previous WASM predated the pruning changes so
new rooms would not have had automatic member lifecycle.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When a user gets pruned for inactivity, their member_info (containing
nickname) is removed. On rejoin the nickname was hardcoded to "Member".

Cache the user's AuthorizedMemberInfo in RoomData.self_member_info and
use it during rejoin so the nickname survives the prune/re-add cycle.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Call capture_self_membership_data in apply_delta and update_room_state
  so the cached nickname stays current after syncs and nickname edits
- Use max_by_key(version) instead of find() for version safety
- Add unit test for capture_self_membership_data verifying nickname
  capture and update behavior

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@sanity sanity merged commit 4583e64 into main Feb 15, 2026
3 of 4 checks passed
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