fix(sidebar): active-room highlight + drag-to-uncategorize (LC-79 follow-up) #138

Merged
nrupard merged 1 commit from fix/sidebar-active-room-and-uncategorize into main 2026-05-18 19:01:07 +02:00
Owner

Bugs

Two follow-ups on the per-enclave categorization refactor (PR #137). Both reported after the redesign branch was up.

1. Selected channel not highlighted when categorized

routes::room::get_room only mutated the uncategorized sidebar_rooms vec to flip room.active = true on the open channel. After the LC-79 redesign categorized rooms live inside sidebar_categories[i].rooms; opening a categorized channel left its sidebar link unhighlighted because the iter_mut().find() missed it. Now scans every category group as a fallback.

2. Can't drag a room back into "All rooms"

The uncategorized list wasn't a drop target. The only uncategorize path was the per-row "Remove from category" dropdown - functional but surprising when every other section accepts drag. Made the uncategorized <ul> a drop target with a new data-uncategorize-url attribute (gated on admin + enclave context). The JS detects the alternate attribute and fires DELETE /enclave/{id}/sidebar/categories/rooms/{room_id} per dropped room.

Branch ordering

Built on top of refactor/lc-79-enclave-scoped-categories (PR #137). Merging this before #137 lands won't apply cleanly - merge #137 first or rebase.

Test plan

  • just check (fmt + clippy across standalone + saas).
  • Manual: open a room inside a category - verify the sidebar link is highlighted (blue background).
  • Manual: drag a categorized room into the "All rooms" section - verify it lands there and persists across reload.
## Bugs Two follow-ups on the per-enclave categorization refactor ([PR #137](https://dev.a8n.run/a8n-tools/lets-chat/pulls/137)). Both reported after the redesign branch was up. ### 1. Selected channel not highlighted when categorized `routes::room::get_room` only mutated the uncategorized `sidebar_rooms` vec to flip `room.active = true` on the open channel. After the LC-79 redesign categorized rooms live inside `sidebar_categories[i].rooms`; opening a categorized channel left its sidebar link unhighlighted because the `iter_mut().find()` missed it. Now scans every category group as a fallback. ### 2. Can't drag a room back into "All rooms" The uncategorized list wasn't a drop target. The only uncategorize path was the per-row "Remove from category" dropdown - functional but surprising when every other section accepts drag. Made the uncategorized `<ul>` a drop target with a new `data-uncategorize-url` attribute (gated on admin + enclave context). The JS detects the alternate attribute and fires `DELETE /enclave/{id}/sidebar/categories/rooms/{room_id}` per dropped room. ## Branch ordering Built on top of `refactor/lc-79-enclave-scoped-categories` (PR #137). Merging this before #137 lands won't apply cleanly - merge #137 first or rebase. ## Test plan - [x] `just check` (fmt + clippy across standalone + saas). - [ ] Manual: open a room inside a category - verify the sidebar link is highlighted (blue background). - [ ] Manual: drag a categorized room into the "All rooms" section - verify it lands there and persists across reload.
fix(sidebar): active-room highlight + drag-to-uncategorize after LC-79 redesign
All checks were successful
Check / clippy + fmt + tests (pull_request) Successful in 1m45s
740f8f907e
Two follow-ups on the per-enclave categorization refactor (PR #137):

1. `routes::room::get_room` only set `room.active = true` on the uncategorized `sidebar_rooms` vec. After the redesign, categorized rooms live inside `sidebar_categories[].rooms`, so opening a categorized channel left it unhighlighted in the sidebar. Now also scans every category group for the active room.

2. The uncategorized "All rooms" list wasn't a drop target, so admins could drag rooms into a category but couldn't drag one back to "All rooms" - the only way to uncategorize was the per-row "Remove from category" dropdown entry. Mark the uncategorized `<ul>` with `data-room-list` + new `data-uncategorize-url` attribute when admin + in an enclave; the JS detects the alternate attribute and fires `DELETE /enclave/{id}/sidebar/categories/rooms/{room_id}` per dropped room rather than the bulk positions PATCH.

Builds on PR #137. Stack accordingly.
nrupard deleted branch fix/sidebar-active-room-and-uncategorize 2026-05-18 19:01:07 +02:00
Sign in to join this conversation.
No reviewers
No labels
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
psa-systems/lets-chat!138
No description provided.