fix(import): trim the already-imported warning

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Gregory Schier
2026-09-10 09:36:55 -07:00
co-authored by Claude Opus 5
parent 3084882829
commit b6818b4f52
2 changed files with 10 additions and 8 deletions
+5 -8
View File
@@ -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<_>>();
plan.warnings.push(ImportPlanWarning::warning(
format!("This document is already imported into {}", display_list(&names)),
"Importing it here makes a second copy instead of updating that one",
format!("Already imported into {}", display_list(&names)),
"Importing here makes a second copy",
));
Ok(())
}
@@ -1758,17 +1758,14 @@ mod tests {
let warning = elsewhere
.warnings
.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");
assert_eq!(
warning.detail,
"Importing it here makes a second copy instead of updating that one"
);
assert_eq!(warning.detail, "Importing here makes a second copy");
// Merging back into the workspace it created is the whole point, so it says nothing.
let merging = replan(&query_manager, &workspace_id, imported_resources());
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
);