Remove ToggleFollow internal action

This commit is contained in:
Antonio Scandurra 2023-04-28 10:07:44 +02:00
parent 06c01a5937
commit f881f9e3d8
4 changed files with 31 additions and 57 deletions

View file

@ -38,9 +38,7 @@ use std::{
},
};
use unindent::Unindent as _;
use workspace::{
item::ItemHandle as _, shared_screen::SharedScreen, SplitDirection, ToggleFollow, Workspace,
};
use workspace::{item::ItemHandle as _, shared_screen::SharedScreen, SplitDirection, Workspace};
#[ctor::ctor]
fn init_logger() {
@ -6117,9 +6115,7 @@ async fn test_basic_following(
// When client B starts following client A, all visible view states are replicated to client B.
workspace_b
.update(cx_b, |workspace, cx| {
workspace
.toggle_follow(&ToggleFollow(peer_id_a), cx)
.unwrap()
workspace.toggle_follow(peer_id_a, cx).unwrap()
})
.await
.unwrap();
@ -6158,9 +6154,7 @@ async fn test_basic_following(
// Client C also follows client A.
workspace_c
.update(cx_c, |workspace, cx| {
workspace
.toggle_follow(&ToggleFollow(peer_id_a), cx)
.unwrap()
workspace.toggle_follow(peer_id_a, cx).unwrap()
})
.await
.unwrap();
@ -6195,7 +6189,7 @@ async fn test_basic_following(
// Client C unfollows client A.
workspace_c.update(cx_c, |workspace, cx| {
workspace.toggle_follow(&ToggleFollow(peer_id_a), cx);
workspace.toggle_follow(peer_id_a, cx);
});
// All clients see that clients B is following client A.
@ -6218,7 +6212,7 @@ async fn test_basic_following(
// Client C re-follows client A.
workspace_c.update(cx_c, |workspace, cx| {
workspace.toggle_follow(&ToggleFollow(peer_id_a), cx);
workspace.toggle_follow(peer_id_a, cx);
});
// All clients see that clients B and C are following client A.
@ -6242,9 +6236,7 @@ async fn test_basic_following(
// Client D follows client C.
workspace_d
.update(cx_d, |workspace, cx| {
workspace
.toggle_follow(&ToggleFollow(peer_id_c), cx)
.unwrap()
workspace.toggle_follow(peer_id_c, cx).unwrap()
})
.await
.unwrap();
@ -6434,9 +6426,7 @@ async fn test_basic_following(
// Client A starts following client B.
workspace_a
.update(cx_a, |workspace, cx| {
workspace
.toggle_follow(&ToggleFollow(peer_id_b), cx)
.unwrap()
workspace.toggle_follow(peer_id_b, cx).unwrap()
})
.await
.unwrap();
@ -6705,9 +6695,7 @@ async fn test_following_tab_order(
//Follow client B as client A
workspace_a
.update(cx_a, |workspace, cx| {
workspace
.toggle_follow(&ToggleFollow(client_b_id), cx)
.unwrap()
workspace.toggle_follow(client_b_id, cx).unwrap()
})
.await
.unwrap();
@ -6822,9 +6810,7 @@ async fn test_peers_following_each_other(
workspace_a
.update(cx_a, |workspace, cx| {
let leader_id = *project_a.read(cx).collaborators().keys().next().unwrap();
workspace
.toggle_follow(&workspace::ToggleFollow(leader_id), cx)
.unwrap()
workspace.toggle_follow(leader_id, cx).unwrap()
})
.await
.unwrap();
@ -6838,9 +6824,7 @@ async fn test_peers_following_each_other(
workspace_b
.update(cx_b, |workspace, cx| {
let leader_id = *project_b.read(cx).collaborators().keys().next().unwrap();
workspace
.toggle_follow(&workspace::ToggleFollow(leader_id), cx)
.unwrap()
workspace.toggle_follow(leader_id, cx).unwrap()
})
.await
.unwrap();
@ -6986,9 +6970,7 @@ async fn test_auto_unfollowing(
});
workspace_b
.update(cx_b, |workspace, cx| {
workspace
.toggle_follow(&ToggleFollow(leader_id), cx)
.unwrap()
workspace.toggle_follow(leader_id, cx).unwrap()
})
.await
.unwrap();
@ -7013,9 +6995,7 @@ async fn test_auto_unfollowing(
workspace_b
.update(cx_b, |workspace, cx| {
workspace
.toggle_follow(&ToggleFollow(leader_id), cx)
.unwrap()
workspace.toggle_follow(leader_id, cx).unwrap()
})
.await
.unwrap();
@ -7033,9 +7013,7 @@ async fn test_auto_unfollowing(
workspace_b
.update(cx_b, |workspace, cx| {
workspace
.toggle_follow(&ToggleFollow(leader_id), cx)
.unwrap()
workspace.toggle_follow(leader_id, cx).unwrap()
})
.await
.unwrap();
@ -7055,9 +7033,7 @@ async fn test_auto_unfollowing(
workspace_b
.update(cx_b, |workspace, cx| {
workspace
.toggle_follow(&ToggleFollow(leader_id), cx)
.unwrap()
workspace.toggle_follow(leader_id, cx).unwrap()
})
.await
.unwrap();
@ -7132,14 +7108,10 @@ async fn test_peers_simultaneously_following_each_other(
});
let a_follow_b = workspace_a.update(cx_a, |workspace, cx| {
workspace
.toggle_follow(&ToggleFollow(client_b_id), cx)
.unwrap()
workspace.toggle_follow(client_b_id, cx).unwrap()
});
let b_follow_a = workspace_b.update(cx_b, |workspace, cx| {
workspace
.toggle_follow(&ToggleFollow(client_a_id), cx)
.unwrap()
workspace.toggle_follow(client_a_id, cx).unwrap()
});
futures::try_join!(a_follow_b, b_follow_a).unwrap();