Repository navigation
Query sidebar directs and shared rooms separately - #318
Open
thomasklemm wants to merge 5 commits into
Open
thomasklemm wants to merge 5 commits into
thomasklemm wants to merge 5 commits into
Conversation
Load visible direct memberships ordered by room recency and other rooms ordered by name, instead of hydrating every membership and splitting them in Ruby. Fixes basecamp#307. Co-authored-by: Thomas Klemm <github@tklemm.eu>
Chaining without_direct_rooms with with_ordered_room joined rooms as `room` while still ordering on `rooms.name`. Load shared rooms in one scope instead. Co-authored-by: Thomas Klemm <github@tklemm.eu>
Directs merge Room.directs and order by recency. Shared rooms reuse with_ordered_room and without_direct_rooms, with the STI filter coming from Room.without_directs so the join alias stays rooms. Co-authored-by: Thomas Klemm <github@tklemm.eu>
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approved
The focused query refactor preserves behavior and is covered by ordering tests.
Review effort: Balanced
Findings: None
What changed in this PR
Separates direct and shared sidebar memberships into dedicated SQL queries while preserving their respective sort orders.
Changes:
- Queries directs by room recency.
- Queries shared rooms alphabetically.
- Adds integration tests for both orderings.
[!TIP]
If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or rungh pr ready --undo.
Click "Ready for review" or rungh pr readyto reengage.
| File | Description |
|---|---|
app/controllers/users/sidebars_controller.rb |
Loads direct and shared memberships separately. |
app/models/membership.rb |
Adds direct filtering and reuses room scopes. |
test/controllers/users/sidebars_controller_test.rb |
Verifies direct and shared ordering. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
thomasklemm
added a commit
to roundhouse-rb/once-campfire
that referenced
this pull request
Oct 5, 2026
From thomasklemm:cursor/split-sidebar-membership-queries-8545 (upstream PR state at merge: OPEN).
…r-membership-queries-8545 Co-authored-by: Thomas Klemm <github@tklemm.eu>
thomasklemm
added a commit
to roundhouse-rb/once-campfire
that referenced
this pull request
Oct 5, 2026
…-prs-8545 Stack basecamp basecamp#318–basecamp#321 onto preview
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
GET /users/me/sidebarloaded every visible membership, split directs in Ruby, then re-sorted them byupdated_at.Directs and shared rooms are now two queries:
merge(Room.directs), ordered by recencywith_ordered_room.without_direct_roomsFixes #307