feat(navigation): clicking an enclave opens last/default room + settings gear (LC-143) #166
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/lc-143-enclave-last-room"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Clicking an enclave opens the room you last had open there (or the default room), instead of an enclave home page. Enclave settings move to a gear button (LC-143).
Changes
GET /enclave/{id}now redirects to the last-opened room in that enclave, validated against the current accessible set; falls back to the default (first, name-ordered) room. The landing page renders only when the enclave has no accessible rooms (empty/onboarding state).0040,enclave_last_room): one row per(user, enclave), upserted on room open inget_room. Survives restart. Stale rows (deleted room / lost access) fall back to the default./enclave/{id}/settings. Gated bySwitcherEntry.can_manage(owner/admin or site admin), computed inload_switcher. Non-managers never see it.Acceptance criteria
Open questions resolved: gear lives in the switcher rail (top-left); last-room is per-account (server-side).
Tests
routes_enclave_nav.rs: default-room redirect, last-room reopen + persistence, empty-enclave landing, gear manager-only visibility. Three existing tests that assumed/enclave/{id}renders the landing updated to follow the redirect. Migration0040appended to hand-rolled lists.just check,just test,just test-saasgreen.🤖 Generated with Claude Code
Clicking an enclave used to land on an enclave home page. Now GET /enclave/{id} redirects to the room the user last had open in that enclave, falling back to the default (first, name-ordered) room. The landing page only renders when the enclave has no accessible rooms - an empty/onboarding state. Persistence (migration 0040, enclave_last_room): one row per (user, enclave), upserted on room open in get_room. Survives restart. A stale row (room deleted or access lost) is validated against the current accessible room set before redirect and falls back to the default. Settings move out of the click target: the enclave switcher rail (top-left) now shows a settings gear on the active enclave's tile, linking to /enclave/{id}/settings. Gated by SwitcherEntry.can_manage (owner/admin or site admin), computed per enclave in load_switcher via perms::enclave_can_manage. Non-managers never see the gear. Tests: routes_enclave_nav.rs covers the default-room redirect, last-room reopen + persistence, the empty-enclave landing fallback, and the gear's manager-only visibility. Updated three existing tests (routes_enclave.rs x2, routes_sidebar_categories.rs) that assumed /enclave/{id} renders the landing - they now follow the redirect to the room page (whose sidebar carries the same room/category markup). Migration 0040 appended to the hand-rolled migration lists. just check, just test, just test-saas all green. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>