[feat] Put materials in folders too - #829
Merged
Merged
Conversation
Materials now carry the same folders as notes, so a PDF or a photo can be filed the day it arrives rather than only once some note uses it. Select materials in the list view and choose Add to a folder; the Folders button above the gallery filters by one, with Unfiled for what has not been filed. The folder vocabulary is shared with notes — the picker offers folders already used by either — so 'Material X' means the same thing whichever side you are on. MediaIndexEntry gains an optional noteContexts and the schema version stays at 7 on purpose: every past bump existed to re-collect usedIn by rescanning notes, and a folder cannot be derived that way. Bumping would buy nothing and cost every user a full rescan. The field survives rebuilds because ensureMediaIndex builds on the existing entries rather than recreating them (#699). Verified through server-fs with the API running: the folder lands in the media index on disk and the filter appears after a reload. The test folder was removed from the real index afterwards. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Contributor
Adversarial probesClick to expand probe results |
Contributor
Bench delta比較できませんでした: main に bench/baseline.json がありません(この PR がベースラインを初めて追加する場合、マージ後の PR から delta が出ます) delta 表を出すには、tracked の |
Contributor
Migration fixturesClick to expand migration results |
Contributor
Performance regressionClick to expand performance results |
…e in Two gaps found while trying the feature: Empty folders never appeared in the material picker. Candidates came only from folders already on notes, and a folder with no notes in it yet — which most subfolders are, right after you create them — is not among those. It read as 'materials cannot go in subfolders'. The appdata folder definitions are now offered too. And a material gave no sign of which folder it was in: the feature could assign and filter but never showed the result. Folders now appear as chips under the name in the list and beside the metadata in the detail header, using the same badge as the notes list. Verified in the running app: a subfolder shows up in the picker, assigning it lands the chip on the row. Folders added while testing were cleared from the real index afterwards. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Put a photo in a note that lives in Material X and the photo now shows up under Material X too, without anyone filing it — the relation is already there in usedIn. This is derived at read time, not written to the index. Writing it would leave residue: change the note's folders later and the material would keep the old ones, and a photo used once would slowly collect folders nobody chose. Deriving means it follows the note — take the note out of the folder and the material stops appearing there — while folders set by hand are never touched and always win on a name clash. Derived folders show in a lighter chip, so it is visible which ones would follow the note rather than being yours to remove. The lookup is not threaded into the material peek that opens from inside the editor, which sits outside this scope; that one still shows hand-set folders only. Verified in the running app: an asset with no folders of its own shows the folder of the note that uses it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
フォルダ機能の残タスク③。素材(画像・PDF・データファイル等)にもフォルダを付けられるようにする。
方針(合意済み)
変更内容
MediaIndexEntryにnoteContexts?: string[]を追加。正規化はノートと共通のnormalizeNoteContextsに任せ、同じ名寄せ規則(小文字比較・表示は初出の形)FilterPopup)。候補はいま見ている種類に実際に付いているものだけ + 未分類ContextTagPickerupdateMediaContexts(use-file-manager)で保存スキーマ版を上げていない理由
CURRENT_MEDIA_INDEX_VERSIONは 7 のままにした。過去の bump(v1〜v7)はすべて「ノートを再走査して usedIn を集め直す」ためのもので、フォルダは人が付ける情報だからノートからは導けない。上げても得るものが無く、全ユーザーに無駄な全走査を強いるだけになる。古いインデックスはこの欄を持たないだけでそのまま読める(optional・後方互換)。再構築で消えないのは、
ensureMediaIndexが既存エントリを土台に usedIn 等を埋め直す設計(#699)に乗っているため。Test Plan
pnpm exec tsc --noEmit— エラーなしpnpm vitest run— 256 ファイル / 3195 テスト全パス(新規 6 件)pnpm build— 成功pnpm run lint:deps— 新規違反なしpnpm manual:check— 問題なしgit diffにシークレット・API キーが含まれないことを確認🤖 Generated with Claude Code