Merge pull request #59 from AppFlowy-IO/entity_api

fix: use borrow
This commit is contained in:
Zack 2023-09-19 09:34:04 +08:00 committed by GitHub
commit 02474c80c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -164,7 +164,7 @@ impl From<Vec<AFWorkspace>> for AFWorkspaces {
}
impl AFWorkspaces {
pub fn get_latest(&self, profile: AFUserProfileView) -> Option<AFWorkspace> {
pub fn get_latest(&self, profile: &AFUserProfileView) -> Option<AFWorkspace> {
match profile.latest_workspace_id {
Some(ws_id) => self.0.iter().find(|ws| ws.workspace_id == ws_id).cloned(),
None => None,

View File

@ -61,7 +61,7 @@ async fn sign_in_success() {
let workspaces = c.workspaces().await.unwrap();
assert!(!workspaces.0.is_empty());
let profile = c.profile().await.unwrap();
let latest_workspace = workspaces.get_latest(profile);
let latest_workspace = workspaces.get_latest(&profile);
assert!(latest_workspace.is_some());
}