Skip to content

Handle room replacements in chat room list - #54

Merged
KallynGowdy merged 1 commit into
devfrom
claude/pensive-shannon-ezly17
Sep 28, 2026
Merged

KallynGowdy merged 1 commit into
devfrom
claude/pensive-shannon-ezly17

Conversation

@KallynGowdy

Copy link
Copy Markdown
Contributor

Description

This change implements support for Matrix room replacements (upgrades) in the chat room list. When a room is tombstoned and replaced by a newer room, the list now:

  1. Follows replacement chains — Automatically resolves rooms to the newest room in their replacement chain, even if multiple upgrades have occurred
  2. Deduplicates — If both an old room and its replacement appear in the list, only the newest is shown
  3. Offers unjoined replacements — If the newest room in a chain hasn't been joined yet, it's shown as an unjoined room the user can join, rather than showing the dead room
  4. Preserves selection context — When a room is replaced, selecting the old room ID also highlights the new room in the list

The implementation adds:

  • resolveReplacedRooms() utility to resolve room IDs through their replacement chains
  • getRoomReplacement() helper to read tombstone state and extract replacement room info
  • ResolvedChatRoom and RoomReplacement types to represent resolved room state
  • ChatListItem type to handle both joined and unjoined resolved rooms in the list
  • Logic to filter out unjoined rooms that are themselves replacements (to avoid showing dead rooms)

The change is driven by live tombstone events (via activityTick), so replacements are detected as they happen.

Test Plan

Added comprehensive unit tests in chatRooms.test.ts covering:

  • Rooms that are never replaced
  • Single replacement in place
  • Deduplication when both old and new rooms are listed
  • Following chains of multiple upgrades
  • Offering unjoined replacements
  • Handling replacement cycles

Run npm test to verify all tests pass.

https://claude.ai/code/session_01HycoSvTLYyVB9Lojzbqxjs

When a room in a community has been replaced (m.room.tombstone), the /app
chat list now follows the replacement chain and shows the newest room in
place of the old one, dropping duplicates when both are listed. If the new
room hasn't been joined yet it is shown with a Join button, and replaced
rooms are hidden from the "More rooms" section.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HycoSvTLYyVB9Lojzbqxjs
@KallynGowdy
KallynGowdy merged commit 9a8132a into dev Sep 28, 2026
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.

2 participants