Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Fix most tests for new chat changes
Mikayladb8096ccdc4d
diff --git a/crates/collab/src/db/tests/buffer_tests.rs b/crates/collab/src/db/tests/buffer_tests.rsindex e5d8ab8cf9a..f6e91b91f01 100644--- a/crates/collab/src/db/tests/buffer_tests.rs+++ b/crates/collab/src/db/tests/buffer_tests.rs@@ -350,7 +350,7 @@ async fn test_channel_buffers_last_operations(db: &Database) {.await.unwrap();- assert_eq!(+ pretty_assertions::assert_eq!(buffer_changes,[rpc::proto::UnseenChannelBufferChange {@@ -361,7 +361,11 @@ async fn test_channel_buffers_last_operations(db: &Database) {rpc::proto::UnseenChannelBufferChange {channel_id: buffers[1].channel_id.to_proto(),epoch: 1,- version: serialize_version(&text_buffers[1].version()),+ version: serialize_version(&text_buffers[1].version())+ .into_iter()+ .filter(|vector| vector.replica_id+ == buffer_changes[1].version.first().unwrap().replica_id)+ .collect::<Vec<_>>(),},rpc::proto::UnseenChannelBufferChange {channel_id: buffers[2].channel_id.to_proto(),diff --git a/crates/collab/src/tests/channel_message_tests.rs b/crates/collab/src/tests/channel_message_tests.rsindex 1b3a54dc428..0ee17cec599 100644--- a/crates/collab/src/tests/channel_message_tests.rs+++ b/crates/collab/src/tests/channel_message_tests.rs@@ -1,7 +1,9 @@use crate::{rpc::RECONNECT_TIMEOUT, tests::TestServer};use channel::{ChannelChat, ChannelMessageId};+use collab_ui::chat_panel::ChatPanel;use gpui::{executor::Deterministic, BorrowAppContext, ModelHandle, TestAppContext};use std::sync::Arc;+use workspace::dock::Panel;#[gpui::test]async fn test_basic_channel_messages(@@ -244,6 +246,15 @@ async fn test_channel_message_changes().await;+ let other_channel_id = server+ .make_channel(+ "other-channel",+ None,+ (&client_a, cx_a),+ &mut [(&client_b, cx_b)],+ )+ .await;+// Client A sends a message, client B should see that there is a new message.let channel_chat_a = client_a.channel_store()@@ -269,12 +280,22 @@ async fn test_channel_message_changes(assert!(b_has_messages);// Opening the chat should clear the changed flag.- let channel_chat_b = client_b- .channel_store()- .update(cx_b, |store, cx| store.open_channel_chat(channel_id, cx))+ cx_b.update(|cx| {+ collab_ui::init(&client_b.app_state, cx);+ });+ let project_b = client_b.build_empty_local_project(cx_b);+ let workspace_b = client_b.build_workspace(&project_b, cx_b).root(cx_b);+ let chat_panel_b = workspace_b.update(cx_b, |workspace, cx| ChatPanel::new(workspace, cx));+ chat_panel_b+ .update(cx_b, |chat_panel, cx| {+ chat_panel.set_active(true, cx);+ chat_panel.select_channel(channel_id, cx)+ }).await.unwrap();+ deterministic.run_until_parked();+let b_has_messages = cx_b.read_with(|cx| {client_b.channel_store()@@ -304,10 +325,7 @@ async fn test_channel_message_changes(assert!(!b_has_messages);// Closing the chat should re-enable change tracking-- cx_b.update(|_| {- drop(channel_chat_b);- });+ todo!();deterministic.run_until_parked();diff --git a/crates/collab_ui/src/chat_panel.rs b/crates/collab_ui/src/chat_panel.rsindex 626b3004d78..2050ee2f69e 100644--- a/crates/collab_ui/src/chat_panel.rs+++ b/crates/collab_ui/src/chat_panel.rs@@ -181,6 +181,10 @@ impl ChatPanel {})}+ pub fn active_chat(&self) -> Option<ModelHandle<ChannelChat>> {+ self.active_chat.as_ref().map(|(chat, _)| chat.clone())+ }+pub fn load(workspace: WeakViewHandle<Workspace>,cx: AsyncAppContext,diff --git a/crates/collab_ui/src/collab_panel.rs b/crates/collab_ui/src/collab_panel.rsindex 5b2b7f00186..6214eecac2a 100644--- a/crates/collab_ui/src/collab_panel.rs+++ b/crates/collab_ui/src/collab_panel.rs@@ -1964,9 +1964,7 @@ impl CollabPanel {.left(),).with_child({- let style = collab_theme- .channel_name- .in_state(channel.unseen_note_version.is_some());+ let style = collab_theme.channel_name.inactive_state();Flex::row().with_child(Label::new(channel.name.clone(), style.text.clone())