Add the ability to reorder favorited collab channels#52649
Merged
JosephTLyons merged 15 commits intomainfrom Mar 30, 2026
Merged
Add the ability to reorder favorited collab channels#52649JosephTLyons merged 15 commits intomainfrom
JosephTLyons merged 15 commits intomainfrom
Conversation
danilo-leal
approved these changes
Mar 30, 2026
…rdering - Add is_favorite field to ListEntry::Channel to distinguish favorite entries from normal channel entries - Update PartialEq to include is_favorite so selection restoration after reorder finds the correct entry instead of jumping to the favorites section - Allow reordering favorites independently via opt+up/down by swapping positions in the local favorite_channels vec - Switch favorite_channels from sorted (binary_search) to user-ordered (linear search) to support custom ordering
- Add entries_as_strings() method on CollabPanel for snapshot-style test assertions, gated behind cfg(test/test-support) - Add test_favorite_channels: tests favoriting, reordering favorites, boundary no-ops, and unfavoriting while asserting the Channels section never changes - Add test_reorder_channels_does_not_affect_favorites: tests server-side channel reorder while asserting the Favorites section is unchanged
Drive tests through SelectNext, SelectPrevious, ToggleSelectedChannelFavorite, MoveChannelUp, and MoveChannelDown to exercise the real user flow. Selection is now tracked and asserted at each step.
When a selected favorite was unfavorited, the selection was lost because the PartialEq change made favorite and non-favorite entries distinct. Now toggle_favorite_channel detects this case and moves the selection to the same channel in the Channels section.
…_selected_channel
On main, toggle_favorite_channel delegates to the channel store which notifies observers. The panel's observer calls update_entries, but this is deferred until after toggle_favorite_channel returns. The selection fix for unfavoriting needs entries to be rebuilt before checking self.selection.is_none(), so we call update_entries explicitly.
8f970d3 to
20f99e4
Compare
When update_entries can't find the previously selected entry, clamp to the same index instead of leaving selection as None. This handles entry removal generically (including unfavoriting) without needing special-case logic in toggle_favorite_channel.
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.
Currently, if you try to re-order a favorite, the favorite will not reorder, but the actual channels will.
reorder_favorites_bug.mov
Additionally, a new bug seems to be that if you reorder channels, focus jumps to a favorite:
reordering_non_favorites_bug.mov
This PR allows for re-ordering of favorites independent of the actual channels, and fixes the focusing bug
reorder_favorites_fix.mov
I didn't feel comfortable adding just the functionality/fixes alone, so I added a function to represent the state of the collab panel as a list of strings, like how testing around the project panel is, and wrote a few tests to ensure the behavior was pinned down.
The tests cover testing:
Self-Review Checklist:
Closes #ISSUE
Release Notes: