feat: added the file name changed to the workspace event (uniform non-unit variant enum)

This commit is contained in:
cschen 2024-08-16 13:01:22 +02:00
parent 0d3af40eb0
commit 9d5aae461f

View file

@ -2,7 +2,7 @@ use codemp_proto::workspace::workspace_event::Event as WorkspaceEventInner;
#[derive(Debug, Clone)]
pub enum Event {
FileTreeUpdated,
FileTreeUpdated(String),
UserJoin(String),
UserLeave(String),
}
@ -12,9 +12,9 @@ impl From<&WorkspaceEventInner> for Event {
match event {
WorkspaceEventInner::Join(e) => Self::UserJoin(e.user.id.clone()),
WorkspaceEventInner::Leave(e) => Self::UserLeave(e.user.id.clone()),
WorkspaceEventInner::Create(_)
| WorkspaceEventInner::Rename(_)
| WorkspaceEventInner::Delete(_) => Self::FileTreeUpdated,
WorkspaceEventInner::Create(e) => Self::FileTreeUpdated(e.path.clone()),
WorkspaceEventInner::Delete(e) => Self::FileTreeUpdated(e.path.clone()),
WorkspaceEventInner::Rename(e) => Self::FileTreeUpdated(e.after.clone()),
}
}
}