fix: exclude non-markdown files from Inbox view

Added isMarkdown check to isInboxEntry so .yml, .json, and binary files
no longer appear in the Inbox. All other views (All Notes, Archive,
Trash, Sections, Views) already filter by markdown. FOLDERS still shows
all file types.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Test
2026-04-05 04:53:52 +02:00
parent 088e0bca8e
commit fe44153ac6
2 changed files with 15 additions and 1 deletions

View File

@@ -730,3 +730,16 @@ describe('filterEntries — fileKind filtering', () => {
expect(result.map(e => e.title)).toEqual(['Old'])
})
})
describe('filterInboxEntries — excludes non-markdown files', () => {
it('only shows markdown files in inbox', () => {
const now = Math.floor(Date.now() / 1000)
const entries = [
makeEntry({ path: '/vault/note.md', title: 'Note', fileKind: 'markdown', createdAt: now }),
makeEntry({ path: '/vault/config.yml', title: 'config.yml', fileKind: 'text', createdAt: now }),
makeEntry({ path: '/vault/photo.png', title: 'photo.png', fileKind: 'binary', createdAt: now }),
]
const result = filterInboxEntries(entries, 'all')
expect(result.map(e => e.title)).toEqual(['Note'])
})
})

View File

@@ -381,8 +381,9 @@ export function countAllByFilter(entries: VaultEntry[]): Record<NoteListFilter,
// --- Inbox ---
/** Check if entry belongs in the Inbox (not organized, not trashed/archived, not a Type). */
/** Check if entry belongs in the Inbox (markdown only, not organized, not trashed/archived, not a Type). */
export function isInboxEntry(entry: VaultEntry): boolean {
if (!isMarkdown(entry)) return false
if (entry.trashed || entry.archived) return false
if (entry.isA === 'Type') return false
return !entry.organized