fix: address ObsidianReviewBot code review issues

- Fix template literal type issue in notifications.ts by adding
  explicit String() coercion for args.recursive
- Replace Vault.trash() with FileManager.trashFile() to respect
  user's configured deletion preferences (system trash or .trash/)
- Remove unused trash() method from IVaultAdapter and VaultAdapter
- Update tests to reflect new deletion behavior
This commit is contained in:
2025-12-20 14:23:56 -05:00
parent 92f5e1c33a
commit f5dd271c65
5 changed files with 16 additions and 20 deletions

View File

@@ -587,7 +587,8 @@ export class NoteTools {
// Dry run - just return what would happen
if (dryRun) {
if (soft) {
destination = `.trash/${file.name}`;
// Destination depends on user's configured deletion preference
destination = 'trash';
}
const result: DeleteNoteResult = {
@@ -603,14 +604,13 @@ export class NoteTools {
};
}
// Perform actual deletion
// Perform actual deletion using user's preferred trash settings
// FileManager.trashFile() respects the user's configured deletion preference
// (system trash or .trash/ folder) as set in Obsidian settings
await this.fileManager.trashFile(file);
if (soft) {
// Move to trash using Obsidian's trash method
await this.vault.trash(file, true);
destination = `.trash/${file.name}`;
} else {
// Delete using user's preferred trash settings (system trash or .trash/ folder)
await this.fileManager.trashFile(file);
// For soft delete, indicate the file was moved to trash (location depends on user settings)
destination = 'trash';
}
const result: DeleteNoteResult = {