Skip to content

Commit

Permalink
feat: added the file name changed to the workspace event (uniform non…
Browse files Browse the repository at this point in the history
…-unit variant enum)
  • Loading branch information
ghyatzo committed Aug 16, 2024
1 parent 0d3af40 commit 9d5aae4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/api/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
}
Expand All @@ -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()),
}
}
}

0 comments on commit 9d5aae4

Please sign in to comment.