Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Fix version check (#55032)

Conrad Irwin1abbaf9c4383
diff --git a/crates/collab/src/rpc.rs b/crates/collab/src/rpc.rs
index 1294b06c8e5..2fbbda032cc 100644
--- a/crates/collab/src/rpc.rs
+++ b/crates/collab/src/rpc.rs
@@ -947,10 +947,6 @@ impl Server {
)?;
}
- if should_auto_subscribe_to_channels(&zed_version) {
- subscribe_user_to_channels(user.id, session).await?;
- }
-
if let Some(incoming_call) =
self.app_state.db.incoming_call_for_user(user.id).await?
{
@@ -2748,10 +2744,6 @@ async fn remove_contact(
Ok(())
}
-fn should_auto_subscribe_to_channels(version: &ZedVersion) -> bool {
- version.0.minor < 139
-}
-
async fn subscribe_to_channels(
_: proto::SubscribeToChannels,
session: MessageContext,
diff --git a/crates/collab/src/rpc/connection_pool.rs b/crates/collab/src/rpc/connection_pool.rs
index 171dea37526..2dc790ea232 100644
--- a/crates/collab/src/rpc/connection_pool.rs
+++ b/crates/collab/src/rpc/connection_pool.rs
@@ -36,12 +36,6 @@ impl ZedVersion {
return false;
}
- // Since we hotfixed the changes to no longer connect to Collab automatically to Preview, we also need to reject
- // versions in the range [v0.199.0, v0.199.1].
- if self.0 >= Version::new(0, 199, 0) && self.0 < Version::new(0, 199, 2) {
- return false;
- }
-
true
}
}
diff --git a/crates/collab/tests/integration/channel_buffer_tests.rs b/crates/collab/tests/integration/channel_buffer_tests.rs
index dd8ae9a2c02..b40ce13c875 100644
--- a/crates/collab/tests/integration/channel_buffer_tests.rs
+++ b/crates/collab/tests/integration/channel_buffer_tests.rs
@@ -657,6 +657,11 @@ async fn test_channel_buffer_changes(
deterministic.advance_clock(ACKNOWLEDGE_DEBOUNCE_INTERVAL);
server
.simulate_long_connection_interruption(client_b.peer_id().unwrap(), deterministic.clone());
+
+ // Re-subscribe to channels after reconnection (simulates collab panel re-rendering)
+ client_b.initialize_channel_store(cx_b);
+ deterministic.run_until_parked();
+
channel_store_b.read_with(cx_b, |channel_store, _| {
assert!(!channel_store.has_channel_buffer_changed(channel_id))
});
diff --git a/crates/collab/tests/integration/channel_tests.rs b/crates/collab/tests/integration/channel_tests.rs
index b42bb32f874..5de3984ece5 100644
--- a/crates/collab/tests/integration/channel_tests.rs
+++ b/crates/collab/tests/integration/channel_tests.rs
@@ -24,6 +24,11 @@ async fn test_core_channels(
let client_a = server.create_client(cx_a, "user_a").await;
let client_b = server.create_client(cx_b, "user_b").await;
+ // Subscribe to channels (simulates opening the collab panel)
+ client_a.initialize_channel_store(cx_a);
+ client_b.initialize_channel_store(cx_b);
+ executor.run_until_parked();
+
let channel_a_id = client_a
.channel_store()
.update(cx_a, |channel_store, cx| {
@@ -290,6 +295,11 @@ async fn test_core_channels(
server.allow_connections();
executor.advance_clock(RECEIVE_TIMEOUT + RECONNECT_TIMEOUT);
+
+ // Re-subscribe to channels after reconnection (simulates collab panel re-rendering)
+ client_a.initialize_channel_store(cx_a);
+ executor.run_until_parked();
+
assert_channels(
client_a.channel_store(),
cx_a,
diff --git a/crates/collab/tests/integration/test_server.rs b/crates/collab/tests/integration/test_server.rs
index f077f5f35cb..33bc373d058 100644
--- a/crates/collab/tests/integration/test_server.rs
+++ b/crates/collab/tests/integration/test_server.rs
@@ -437,7 +437,12 @@ impl TestServer {
admin: (&TestClient, &mut TestAppContext),
members: &mut [(&TestClient, &mut TestAppContext)],
) -> ChannelId {
- let (_, admin_cx) = admin;
+ let (admin_client, admin_cx) = admin;
+
+ // Subscribe to channels (simulates opening the collab panel)
+ admin_client.initialize_channel_store(admin_cx);
+ admin_cx.executor().run_until_parked();
+
let channel_id = admin_cx
.read(ChannelStore::global)
.update(admin_cx, |channel_store, cx| {
@@ -447,6 +452,10 @@ impl TestServer {
.unwrap();
for (member_client, member_cx) in members {
+ // Subscribe member to channels (simulates opening the collab panel)
+ member_client.initialize_channel_store(member_cx);
+ member_cx.executor().run_until_parked();
+
admin_cx
.read(ChannelStore::global)
.update(admin_cx, |channel_store, cx| {
@@ -665,6 +674,12 @@ impl TestClient {
.await;
}
+ /// Subscribe to channels. In production this happens when the user opens the collab panel.
+ pub fn initialize_channel_store(&self, cx: &mut TestAppContext) {
+ self.channel_store
+ .update(cx, |channel_store, _| channel_store.initialize());
+ }
+
pub fn local_projects(&self) -> impl Deref<Target = Vec<Entity<Project>>> + '_ {
Ref::map(self.state.borrow(), |state| &state.local_projects)
}