fix(sidebar): scrub categorization on room leave (LC-79 AC #5) #133
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/lc-79-ac5-forget-room-on-leave"
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
Closes the last open acceptance criterion for LC-79: #5, "Leaving a room removes it from any category automatically." Phase-3 review surfaced that
db::sidebar_categories::forget_roomexisted but had no callers; this PR wires it (plus a new bulkforget_rooms) into the three leave / kick handlers.Behaviour
routes::enclave::post_leave(user leaves an enclave): resolves the enclave's rooms vialist_rooms_in_enclave(can_see_all_private=false)so only rooms the user was actually a member of get scrubbed, then bulk-deletes theirsidebar_category_roomsrows via the newforget_roomshelper.routes::enclave::post_kick(admin kicks user from enclave): same pattern with the kicked user's id.routes::enclave::post_remove_room_member(admin removes user from a single private room): single-roomforget_room.Why it matters
Without the cleanup, the assignment row in
auth.dboutlived the user's access to the room inchat.db.load_sidebarwas already filtering inaccessible rooms out at render time, so the bug was silent while the user was out. The visible regression was re-joining: the stale row resurrected the categorization, putting the room back in the category the user had it in before they left. Now the row is dropped at leave time, so re-joining starts fresh in "All rooms".Acceptance criteria
Test plan
forget_rooms_drops_only_named_assignments(new): empty slice is no-op; named ids dropped; un-named id stays.just check+just testgreen (10 sidebar tests pass).