Currently, if you try to re-order a favorite, the favorite will not reorder, but the actual channels will. https://github.com/user-attachments/assets/1fbab9ea-4ff4-473f-8de3-d3b60696c5a1 Additionally, a new bug seems to be that if you reorder channels, focus jumps to a favorite: https://github.com/user-attachments/assets/fa776ad2-8648-4e68-a253-a98f57bd4951 This PR allows for re-ordering of favorites independent of the actual channels, and fixes the focusing bug https://github.com/user-attachments/assets/977e575a-055c-4f26-8183-2744ff7f8f56 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: - Favoriting/unfavoriting - Reordering favorites without impacting order of channels in the channels list - Reordering channels in the channels list without impacting order of favorites Self-Review Checklist: - [x] I've reviewed my own diff for quality, security, and reliability - [x] Unsafe blocks (if any) have justifying comments - [x] The content is consistent with the [UI/UX checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) - [x] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable Closes #ISSUE Release Notes: - Added the ability to reorder favorited collab channels.
54 lines
1.5 KiB
Rust
54 lines
1.5 KiB
Rust
use call::Room;
|
|
use client::ChannelId;
|
|
use gpui::{Entity, TestAppContext};
|
|
|
|
mod agent_sharing_tests;
|
|
mod channel_buffer_tests;
|
|
mod channel_guest_tests;
|
|
mod channel_tests;
|
|
mod collab_panel_tests;
|
|
mod db_tests;
|
|
mod editor_tests;
|
|
mod following_tests;
|
|
mod git_tests;
|
|
mod integration_tests;
|
|
mod notification_tests;
|
|
mod random_channel_buffer_tests;
|
|
mod random_project_collaboration_tests;
|
|
mod randomized_test_helpers;
|
|
mod remote_editing_collaboration_tests;
|
|
mod test_server;
|
|
|
|
pub use randomized_test_helpers::{
|
|
RandomizedTest, TestError, UserTestPlan, run_randomized_test, save_randomized_test_plan,
|
|
};
|
|
pub use test_server::{TestClient, TestServer};
|
|
|
|
#[derive(Debug, Eq, PartialEq)]
|
|
struct RoomParticipants {
|
|
remote: Vec<String>,
|
|
pending: Vec<String>,
|
|
}
|
|
|
|
fn room_participants(room: &Entity<Room>, cx: &mut TestAppContext) -> RoomParticipants {
|
|
room.read_with(cx, |room, _| {
|
|
let mut remote = room
|
|
.remote_participants()
|
|
.values()
|
|
.map(|participant| participant.user.github_login.clone().to_string())
|
|
.collect::<Vec<_>>();
|
|
let mut pending = room
|
|
.pending_participants()
|
|
.iter()
|
|
.map(|user| user.github_login.clone().to_string())
|
|
.collect::<Vec<_>>();
|
|
remote.sort();
|
|
pending.sort();
|
|
RoomParticipants { remote, pending }
|
|
})
|
|
}
|
|
|
|
fn channel_id(room: &Entity<Room>, cx: &mut TestAppContext) -> Option<ChannelId> {
|
|
cx.read(|cx| room.read(cx).channel_id())
|
|
}
|