refactor: remove Trash system — delete is now permanent with confirm modal
Remove all vestiges of the abandoned Trash system: trashed/trashedAt fields from types, frontmatter parsing, sidebar filtering, editor banners, inspector components, mock data, and all related tests. Delete is already permanent via useDeleteActions with a confirmation dialog. Notes with trashed:true in existing vault frontmatter are now treated as normal notes (the flag is ignored by the parser). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -13,8 +13,6 @@ const makeEntry = (overrides: Partial<VaultEntry> = {}): VaultEntry => ({
|
||||
relatedTo: [],
|
||||
status: 'Active',
|
||||
archived: false,
|
||||
trashed: false,
|
||||
trashedAt: null,
|
||||
modifiedAt: 1700000000,
|
||||
createdAt: 1700000000,
|
||||
fileSize: 100,
|
||||
@@ -218,26 +216,6 @@ describe('useNoteSearch', () => {
|
||||
expect(result.current.results[0].title).toBe('Refactoring Notes')
|
||||
})
|
||||
|
||||
it('excludes trashed notes from results', () => {
|
||||
const withTrashed: VaultEntry[] = [
|
||||
makeEntry({ path: '/vault/a.md', title: 'Active Note', modifiedAt: 1700000003 }),
|
||||
makeEntry({ path: '/vault/t.md', title: 'Trashed Note', trashed: true, trashedAt: 1700000000, modifiedAt: 1700000002 }),
|
||||
makeEntry({ path: '/vault/b.md', title: 'Another Active', modifiedAt: 1700000001 }),
|
||||
]
|
||||
const { result } = renderHook(() => useNoteSearch(withTrashed, ''))
|
||||
expect(result.current.results.map(r => r.title)).toEqual(['Active Note', 'Another Active'])
|
||||
})
|
||||
|
||||
it('excludes trashed notes from search results by query', () => {
|
||||
const withTrashed: VaultEntry[] = [
|
||||
makeEntry({ path: '/vault/a.md', title: 'Meeting Notes', modifiedAt: 1700000002 }),
|
||||
makeEntry({ path: '/vault/t.md', title: 'Meeting Draft', trashed: true, modifiedAt: 1700000001 }),
|
||||
]
|
||||
const { result } = renderHook(() => useNoteSearch(withTrashed, 'Meeting'))
|
||||
expect(result.current.results).toHaveLength(1)
|
||||
expect(result.current.results[0].title).toBe('Meeting Notes')
|
||||
})
|
||||
|
||||
it('does not exclude archived notes from results', () => {
|
||||
const withArchived: VaultEntry[] = [
|
||||
makeEntry({ path: '/vault/a.md', title: 'Active Note', modifiedAt: 1700000002 }),
|
||||
|
||||
Reference in New Issue
Block a user