Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/releases/unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,4 @@ When a change has user-facing documentation, include a canonical tasknotes.dev l
## Fixed

- (#2382) Fixed Kanban settings being ignored in existing `.base` files when nested under `options:` or `config:`, including empty-column hiding and pinned columns. Newly generated default files and exported v3 views now write settings directly on each view; existing files remain unchanged. See [Kanban View](https://tasknotes.dev/views/kanban-view/#configuration). Thanks to @techwiththiru for reporting this.
- (#2390) Fixed the "Add to Project" modal listing notes from folders set in the Excluded folders setting. Thanks to @hikatamika for reporting this.
5 changes: 4 additions & 1 deletion src/modals/ProjectSelectModal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { getProjectPropertyFilter, matchesProjectProperty } from "../utils/proje
import { FilterUtils } from "../utils/FilterUtils";
import { collectCacheTags } from "../utils/tagExtraction";
import { getActiveFolderPath, isPathInIncludedFolders } from "../suggest/FileSuggestHelper";
import { isPathInExcludedFolder, parseExcludedFolders } from "../utils/pathExclusions";
import { createTaskNotesLogger } from "../utils/tasknotesLogger";

const tasknotesLogger = createTaskNotesLogger({ tag: "Modals/ProjectSelectModal" });
Expand All @@ -38,13 +39,15 @@ export class ProjectSelectModal extends FuzzySuggestModal<TAbstractFile> {
}

getItems(): TAbstractFile[] {
const excludedFolders = parseExcludedFolders(this.plugin.settings?.excludedFolders);
const allFiles = this.app.vault
.getAllLoadedFiles()
.filter(
(file) =>
file instanceof TFile &&
file.extension === "md" &&
!file.path.includes(".trash")
!file.path.includes(".trash") &&
!isPathInExcludedFolder(file.path, excludedFolders)
);

// Get filtering settings
Expand Down
16 changes: 16 additions & 0 deletions tests/unit/modals/ProjectSelectModal.property-filter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,20 @@ describe('ProjectSelectModal property filtering', () => {
expect(paths).not.toContain('Projects/Alpha.md');
expect(paths).not.toContain('Notes/Idea.md');
});

it('excludes files in the configured excluded folders even without other filters', async () => {
mockPlugin.settings.projectAutosuggest.propertyKey = '';
mockPlugin.settings.projectAutosuggest.propertyValue = '';
mockPlugin.settings.excludedFolders = '_src, Notes';

await mockApp.vault.create('_src/Hidden.md', '');
mockApp.metadataCache.setCache('_src/Hidden.md', { frontmatter: {}, tags: [] });

const modal = new ProjectSelectModal(mockApp, mockPlugin, jest.fn());
const paths = modal.getItems().map(item => (item as any).path ?? '');

expect(paths).toContain('Projects/Alpha.md');
expect(paths).not.toContain('_src/Hidden.md');
expect(paths).not.toContain('Notes/Idea.md');
});
});