Rename OpenWorktree message to JoinWorktree

We'll repurpose the name 'OpenWorktree' for opening a local
worktree while signed in, and advertising the open status to
the worktree's collaborators.
This commit is contained in:
Max Brunsfeld 2021-09-16 11:25:31 -07:00
parent f0093974ee
commit 176ca9086e
4 changed files with 18 additions and 18 deletions

View file

@ -293,7 +293,7 @@ impl Server {
async fn join_worktree(
self: Arc<Server>,
request: TypedEnvelope<proto::OpenWorktree>,
request: TypedEnvelope<proto::JoinWorktree>,
) -> tide::Result<()> {
let worktree_id = request.payload.worktree_id;
let access_token = &request.payload.access_token;
@ -334,7 +334,7 @@ impl Server {
self.peer
.respond(
request.receipt(),
proto::OpenWorktreeResponse {
proto::JoinWorktreeResponse {
worktree_id,
worktree: Some(proto::Worktree {
root_name: worktree.root_name.clone(),
@ -349,7 +349,7 @@ impl Server {
self.peer
.respond(
request.receipt(),
proto::OpenWorktreeResponse {
proto::JoinWorktreeResponse {
worktree_id,
worktree: None,
replica_id: 0,

View file

@ -117,7 +117,7 @@ impl Worktree {
cx: &mut AsyncAppContext,
) -> Result<ModelHandle<Self>> {
let response = rpc
.request(proto::OpenWorktree {
.request(proto::JoinWorktree {
worktree_id: id,
access_token,
})
@ -127,18 +127,18 @@ impl Worktree {
}
async fn remote(
open_response: proto::OpenWorktreeResponse,
join_response: proto::JoinWorktreeResponse,
rpc: Arc<rpc::Client>,
languages: Arc<LanguageRegistry>,
cx: &mut AsyncAppContext,
) -> Result<ModelHandle<Self>> {
let worktree = open_response
let worktree = join_response
.worktree
.ok_or_else(|| anyhow!("empty worktree"))?;
let remote_id = open_response.worktree_id;
let replica_id = open_response.replica_id as ReplicaId;
let peers = open_response.peers;
let remote_id = join_response.worktree_id;
let replica_id = join_response.replica_id as ReplicaId;
let peers = join_response.peers;
let root_char_bag: CharBag = worktree
.root_name
.chars()
@ -2780,7 +2780,7 @@ mod tests {
})
.await;
let remote = Worktree::remote(
proto::OpenWorktreeResponse {
proto::JoinWorktreeResponse {
worktree_id,
worktree: share_request.worktree,
replica_id: 1,

View file

@ -11,8 +11,8 @@ message Envelope {
Ping ping = 6;
ShareWorktree share_worktree = 7;
ShareWorktreeResponse share_worktree_response = 8;
OpenWorktree open_worktree = 9;
OpenWorktreeResponse open_worktree_response = 10;
JoinWorktree join_worktree = 9;
JoinWorktreeResponse join_worktree_response = 10;
UpdateWorktree update_worktree = 11;
CloseWorktree close_worktree = 12;
OpenBuffer open_buffer = 13;
@ -57,12 +57,12 @@ message ShareWorktreeResponse {
string access_token = 2;
}
message OpenWorktree {
message JoinWorktree {
uint64 worktree_id = 1;
string access_token = 2;
}
message OpenWorktreeResponse {
message JoinWorktreeResponse {
uint64 worktree_id = 1;
Worktree worktree = 2;
uint32 replica_id = 3;

View file

@ -138,8 +138,8 @@ messages!(
LeaveChannel,
OpenBuffer,
OpenBufferResponse,
OpenWorktree,
OpenWorktreeResponse,
JoinWorktree,
JoinWorktreeResponse,
Ping,
RemovePeer,
SaveBuffer,
@ -156,7 +156,7 @@ request_messages!(
(GetUsers, GetUsersResponse),
(JoinChannel, JoinChannelResponse),
(OpenBuffer, OpenBufferResponse),
(OpenWorktree, OpenWorktreeResponse),
(JoinWorktree, JoinWorktreeResponse),
(Ping, Ack),
(SaveBuffer, BufferSaved),
(UpdateBuffer, Ack),
@ -172,7 +172,7 @@ entity_messages!(
CloseBuffer,
CloseWorktree,
OpenBuffer,
OpenWorktree,
JoinWorktree,
RemovePeer,
SaveBuffer,
UpdateBuffer,