mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-09-11 12:21:45 +02:00
fix(import): trim the already-imported warning
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
3084882829
commit
b6818b4f52
Generated
+5
@@ -0,0 +1,5 @@
|
|||||||
|
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||||
|
|
||||||
|
export type MethodDefinition = { name: string, schema: string, clientStreaming: boolean, serverStreaming: boolean, };
|
||||||
|
|
||||||
|
export type ServiceDefinition = { name: string, methods: Array<MethodDefinition>, };
|
||||||
@@ -331,8 +331,8 @@ fn warn_if_imported_elsewhere(db: &ClientDb, plan: &mut ImportPlan) -> Result<()
|
|||||||
}
|
}
|
||||||
let names = names.iter().map(String::as_str).collect::<BTreeSet<_>>();
|
let names = names.iter().map(String::as_str).collect::<BTreeSet<_>>();
|
||||||
plan.warnings.push(ImportPlanWarning::warning(
|
plan.warnings.push(ImportPlanWarning::warning(
|
||||||
format!("This document is already imported into {}", display_list(&names)),
|
format!("Already imported into {}", display_list(&names)),
|
||||||
"Importing it here makes a second copy instead of updating that one",
|
"Importing here makes a second copy",
|
||||||
));
|
));
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
@@ -1758,17 +1758,14 @@ mod tests {
|
|||||||
let warning = elsewhere
|
let warning = elsewhere
|
||||||
.warnings
|
.warnings
|
||||||
.iter()
|
.iter()
|
||||||
.find(|w| w.title == "This document is already imported into Imported")
|
.find(|w| w.title == "Already imported into Imported")
|
||||||
.expect("copying a document that already landed somewhere is called out");
|
.expect("copying a document that already landed somewhere is called out");
|
||||||
assert_eq!(
|
assert_eq!(warning.detail, "Importing here makes a second copy");
|
||||||
warning.detail,
|
|
||||||
"Importing it here makes a second copy instead of updating that one"
|
|
||||||
);
|
|
||||||
|
|
||||||
// Merging back into the workspace it created is the whole point, so it says nothing.
|
// Merging back into the workspace it created is the whole point, so it says nothing.
|
||||||
let merging = replan(&query_manager, &workspace_id, imported_resources());
|
let merging = replan(&query_manager, &workspace_id, imported_resources());
|
||||||
assert!(
|
assert!(
|
||||||
merging.warnings.iter().all(|w| !w.title.starts_with("This document is already")),
|
merging.warnings.iter().all(|w| !w.title.starts_with("Already imported")),
|
||||||
"{:?}",
|
"{:?}",
|
||||||
merging.warnings
|
merging.warnings
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user