Rename a public/private to online/offline in a few more places

This commit is contained in:
Max Brunsfeld 2022-06-03 17:08:44 -07:00
parent ed14fd6e0d
commit 41b7fd4a27
2 changed files with 19 additions and 19 deletions

View File

@ -22,7 +22,7 @@ use serde::Deserialize;
use settings::Settings;
use std::{ops::DerefMut, sync::Arc};
use theme::IconButton;
use workspace::{sidebar::SidebarItem, JoinProject, ToggleProjectPublic, Workspace};
use workspace::{sidebar::SidebarItem, JoinProject, ToggleProjectOnline, Workspace};
impl_actions!(
contacts_panel,
@ -417,7 +417,7 @@ impl ContactsPanel {
return None;
}
let button = MouseEventHandler::new::<ToggleProjectPublic, _, _>(
let button = MouseEventHandler::new::<ToggleProjectOnline, _, _>(
project_id as usize,
cx,
|state, _| {
@ -441,7 +441,7 @@ impl ContactsPanel {
button
.with_cursor_style(CursorStyle::PointingHand)
.on_click(move |_, _, cx| {
cx.dispatch_action(ToggleProjectPublic {
cx.dispatch_action(ToggleProjectOnline {
project: Some(open_project.clone()),
})
})
@ -525,7 +525,7 @@ impl ContactsPanel {
.unwrap_or(0.);
enum LocalProject {}
enum TogglePublic {}
enum ToggleOnline {}
let project_id = project.id();
MouseEventHandler::new::<LocalProject, _, _>(project_id, cx, |state, cx| {
@ -543,7 +543,7 @@ impl ContactsPanel {
Flex::row()
.with_child({
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);
if is_going_online {
style.color = theme.disabled_button.color;
@ -561,7 +561,7 @@ impl ContactsPanel {
button
.with_cursor_style(CursorStyle::PointingHand)
.on_click(move |_, _, cx| {
cx.dispatch_action(ToggleProjectPublic {
cx.dispatch_action(ToggleProjectOnline {
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.
project.update(cx, |project, cx| project.set_online(true, cx));
cx.foreground().run_until_parked();
@ -1362,7 +1362,7 @@ mod tests {
"v Online",
" the_current_user",
" dir3",
" 🔒 private_dir (becoming public...)",
" 🔒 private_dir (going online...)",
" user_four",
" dir2",
" user_three",
@ -1392,7 +1392,7 @@ mod tests {
"v Online",
" the_current_user",
" dir3",
" 🔒 private_dir (becoming public...)",
" 🔒 private_dir (going online...)",
" user_four",
" dir2",
" user_three",
@ -1403,7 +1403,7 @@ mod tests {
);
// 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!(
server
.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));
cx.foreground().run_until_parked();
assert_eq!(
@ -1469,7 +1469,7 @@ mod tests {
"v Online",
" the_current_user",
" dir3",
" private_dir (becoming private...)",
" private_dir (going offline...)",
" user_four",
" dir2",
" user_three",
@ -1480,7 +1480,7 @@ mod tests {
);
// 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();
server.send(proto::UpdateContacts {
contacts: vec![proto::Contact {
@ -1615,7 +1615,7 @@ mod tests {
if project.map_or(true, |project| project.is_online()) {
""
} else {
" (becoming private...)"
" (going offline...)"
},
)
}
@ -1628,7 +1628,7 @@ mod tests {
.collect::<Vec<_>>()
.join(", "),
if project.is_online() {
" (becoming public...)"
" (going online...)"
} else {
""
},

View File

@ -100,7 +100,7 @@ pub struct OpenPaths {
}
#[derive(Clone, Deserialize)]
pub struct ToggleProjectPublic {
pub struct ToggleProjectOnline {
#[serde(skip_deserializing)]
pub project: Option<ModelHandle<Project>>,
}
@ -123,7 +123,7 @@ impl_internal_actions!(
RemoveFolderFromProject
]
);
impl_actions!(workspace, [ToggleProjectPublic]);
impl_actions!(workspace, [ToggleProjectOnline]);
pub fn init(app_state: Arc<AppState>, cx: &mut MutableAppContext) {
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_action(Workspace::add_folder_to_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(
|workspace: &mut Workspace, _: &Unfollow, cx: &mut ViewContext<Workspace>| {
let pane = workspace.active_pane().clone();
@ -1049,7 +1049,7 @@ impl Workspace {
.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
.project
.clone()