mirror of
https://github.com/zed-industries/zed.git
synced 2024-11-09 21:26:14 +03:00
Rename a public/private to online/offline in a few more places
This commit is contained in:
parent
ed14fd6e0d
commit
41b7fd4a27
@ -22,7 +22,7 @@ use serde::Deserialize;
|
|||||||
use settings::Settings;
|
use settings::Settings;
|
||||||
use std::{ops::DerefMut, sync::Arc};
|
use std::{ops::DerefMut, sync::Arc};
|
||||||
use theme::IconButton;
|
use theme::IconButton;
|
||||||
use workspace::{sidebar::SidebarItem, JoinProject, ToggleProjectPublic, Workspace};
|
use workspace::{sidebar::SidebarItem, JoinProject, ToggleProjectOnline, Workspace};
|
||||||
|
|
||||||
impl_actions!(
|
impl_actions!(
|
||||||
contacts_panel,
|
contacts_panel,
|
||||||
@ -417,7 +417,7 @@ impl ContactsPanel {
|
|||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
let button = MouseEventHandler::new::<ToggleProjectPublic, _, _>(
|
let button = MouseEventHandler::new::<ToggleProjectOnline, _, _>(
|
||||||
project_id as usize,
|
project_id as usize,
|
||||||
cx,
|
cx,
|
||||||
|state, _| {
|
|state, _| {
|
||||||
@ -441,7 +441,7 @@ impl ContactsPanel {
|
|||||||
button
|
button
|
||||||
.with_cursor_style(CursorStyle::PointingHand)
|
.with_cursor_style(CursorStyle::PointingHand)
|
||||||
.on_click(move |_, _, cx| {
|
.on_click(move |_, _, cx| {
|
||||||
cx.dispatch_action(ToggleProjectPublic {
|
cx.dispatch_action(ToggleProjectOnline {
|
||||||
project: Some(open_project.clone()),
|
project: Some(open_project.clone()),
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@ -525,7 +525,7 @@ impl ContactsPanel {
|
|||||||
.unwrap_or(0.);
|
.unwrap_or(0.);
|
||||||
|
|
||||||
enum LocalProject {}
|
enum LocalProject {}
|
||||||
enum TogglePublic {}
|
enum ToggleOnline {}
|
||||||
|
|
||||||
let project_id = project.id();
|
let project_id = project.id();
|
||||||
MouseEventHandler::new::<LocalProject, _, _>(project_id, cx, |state, cx| {
|
MouseEventHandler::new::<LocalProject, _, _>(project_id, cx, |state, cx| {
|
||||||
@ -543,7 +543,7 @@ impl ContactsPanel {
|
|||||||
Flex::row()
|
Flex::row()
|
||||||
.with_child({
|
.with_child({
|
||||||
let button =
|
let button =
|
||||||
MouseEventHandler::new::<TogglePublic, _, _>(project_id, cx, |state, _| {
|
MouseEventHandler::new::<ToggleOnline, _, _>(project_id, cx, |state, _| {
|
||||||
let mut style = *theme.private_button.style_for(state, false);
|
let mut style = *theme.private_button.style_for(state, false);
|
||||||
if is_going_online {
|
if is_going_online {
|
||||||
style.color = theme.disabled_button.color;
|
style.color = theme.disabled_button.color;
|
||||||
@ -561,7 +561,7 @@ impl ContactsPanel {
|
|||||||
button
|
button
|
||||||
.with_cursor_style(CursorStyle::PointingHand)
|
.with_cursor_style(CursorStyle::PointingHand)
|
||||||
.on_click(move |_, _, cx| {
|
.on_click(move |_, _, cx| {
|
||||||
cx.dispatch_action(ToggleProjectPublic {
|
cx.dispatch_action(ToggleProjectOnline {
|
||||||
project: Some(project.clone()),
|
project: Some(project.clone()),
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@ -1349,7 +1349,7 @@ mod tests {
|
|||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
// Make a project public. It appears as loading, since the project
|
// Take a project online. It appears as loading, since the project
|
||||||
// isn't yet visible to other contacts.
|
// isn't yet visible to other contacts.
|
||||||
project.update(cx, |project, cx| project.set_online(true, cx));
|
project.update(cx, |project, cx| project.set_online(true, cx));
|
||||||
cx.foreground().run_until_parked();
|
cx.foreground().run_until_parked();
|
||||||
@ -1362,7 +1362,7 @@ mod tests {
|
|||||||
"v Online",
|
"v Online",
|
||||||
" the_current_user",
|
" the_current_user",
|
||||||
" dir3",
|
" dir3",
|
||||||
" 🔒 private_dir (becoming public...)",
|
" 🔒 private_dir (going online...)",
|
||||||
" user_four",
|
" user_four",
|
||||||
" dir2",
|
" dir2",
|
||||||
" user_three",
|
" user_three",
|
||||||
@ -1392,7 +1392,7 @@ mod tests {
|
|||||||
"v Online",
|
"v Online",
|
||||||
" the_current_user",
|
" the_current_user",
|
||||||
" dir3",
|
" dir3",
|
||||||
" 🔒 private_dir (becoming public...)",
|
" 🔒 private_dir (going online...)",
|
||||||
" user_four",
|
" user_four",
|
||||||
" dir2",
|
" dir2",
|
||||||
" user_three",
|
" user_three",
|
||||||
@ -1403,7 +1403,7 @@ mod tests {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// The server receives the project's metadata and updates the contact metadata
|
// The server receives the project's metadata and updates the contact metadata
|
||||||
// for the current user. Now the project appears as public.
|
// for the current user. Now the project appears as online.
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
server
|
server
|
||||||
.receive::<proto::UpdateProject>()
|
.receive::<proto::UpdateProject>()
|
||||||
@ -1457,7 +1457,7 @@ mod tests {
|
|||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
// Make the project private. It appears as loading.
|
// Take the project offline. It appears as loading.
|
||||||
project.update(cx, |project, cx| project.set_online(false, cx));
|
project.update(cx, |project, cx| project.set_online(false, cx));
|
||||||
cx.foreground().run_until_parked();
|
cx.foreground().run_until_parked();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
@ -1469,7 +1469,7 @@ mod tests {
|
|||||||
"v Online",
|
"v Online",
|
||||||
" the_current_user",
|
" the_current_user",
|
||||||
" dir3",
|
" dir3",
|
||||||
" private_dir (becoming private...)",
|
" private_dir (going offline...)",
|
||||||
" user_four",
|
" user_four",
|
||||||
" dir2",
|
" dir2",
|
||||||
" user_three",
|
" user_three",
|
||||||
@ -1480,7 +1480,7 @@ mod tests {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// The server receives the unregister request and updates the contact
|
// The server receives the unregister request and updates the contact
|
||||||
// metadata for the current user. The project is now private.
|
// metadata for the current user. The project is now offline.
|
||||||
let request = server.receive::<proto::UnregisterProject>().await.unwrap();
|
let request = server.receive::<proto::UnregisterProject>().await.unwrap();
|
||||||
server.send(proto::UpdateContacts {
|
server.send(proto::UpdateContacts {
|
||||||
contacts: vec![proto::Contact {
|
contacts: vec![proto::Contact {
|
||||||
@ -1615,7 +1615,7 @@ mod tests {
|
|||||||
if project.map_or(true, |project| project.is_online()) {
|
if project.map_or(true, |project| project.is_online()) {
|
||||||
""
|
""
|
||||||
} else {
|
} else {
|
||||||
" (becoming private...)"
|
" (going offline...)"
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -1628,7 +1628,7 @@ mod tests {
|
|||||||
.collect::<Vec<_>>()
|
.collect::<Vec<_>>()
|
||||||
.join(", "),
|
.join(", "),
|
||||||
if project.is_online() {
|
if project.is_online() {
|
||||||
" (becoming public...)"
|
" (going online...)"
|
||||||
} else {
|
} else {
|
||||||
""
|
""
|
||||||
},
|
},
|
||||||
|
@ -100,7 +100,7 @@ pub struct OpenPaths {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Deserialize)]
|
#[derive(Clone, Deserialize)]
|
||||||
pub struct ToggleProjectPublic {
|
pub struct ToggleProjectOnline {
|
||||||
#[serde(skip_deserializing)]
|
#[serde(skip_deserializing)]
|
||||||
pub project: Option<ModelHandle<Project>>,
|
pub project: Option<ModelHandle<Project>>,
|
||||||
}
|
}
|
||||||
@ -123,7 +123,7 @@ impl_internal_actions!(
|
|||||||
RemoveFolderFromProject
|
RemoveFolderFromProject
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
impl_actions!(workspace, [ToggleProjectPublic]);
|
impl_actions!(workspace, [ToggleProjectOnline]);
|
||||||
|
|
||||||
pub fn init(app_state: Arc<AppState>, cx: &mut MutableAppContext) {
|
pub fn init(app_state: Arc<AppState>, cx: &mut MutableAppContext) {
|
||||||
pane::init(cx);
|
pane::init(cx);
|
||||||
@ -168,7 +168,7 @@ pub fn init(app_state: Arc<AppState>, cx: &mut MutableAppContext) {
|
|||||||
cx.add_async_action(Workspace::save_all);
|
cx.add_async_action(Workspace::save_all);
|
||||||
cx.add_action(Workspace::add_folder_to_project);
|
cx.add_action(Workspace::add_folder_to_project);
|
||||||
cx.add_action(Workspace::remove_folder_from_project);
|
cx.add_action(Workspace::remove_folder_from_project);
|
||||||
cx.add_action(Workspace::toggle_project_public);
|
cx.add_action(Workspace::toggle_project_online);
|
||||||
cx.add_action(
|
cx.add_action(
|
||||||
|workspace: &mut Workspace, _: &Unfollow, cx: &mut ViewContext<Workspace>| {
|
|workspace: &mut Workspace, _: &Unfollow, cx: &mut ViewContext<Workspace>| {
|
||||||
let pane = workspace.active_pane().clone();
|
let pane = workspace.active_pane().clone();
|
||||||
@ -1049,7 +1049,7 @@ impl Workspace {
|
|||||||
.update(cx, |project, cx| project.remove_worktree(*worktree_id, cx));
|
.update(cx, |project, cx| project.remove_worktree(*worktree_id, cx));
|
||||||
}
|
}
|
||||||
|
|
||||||
fn toggle_project_public(&mut self, action: &ToggleProjectPublic, cx: &mut ViewContext<Self>) {
|
fn toggle_project_online(&mut self, action: &ToggleProjectOnline, cx: &mut ViewContext<Self>) {
|
||||||
let project = action
|
let project = action
|
||||||
.project
|
.project
|
||||||
.clone()
|
.clone()
|
||||||
|
Loading…
Reference in New Issue
Block a user