diff --git a/src/web/case-path.ts b/src/web/case-path.ts index df950396..369464d9 100644 --- a/src/web/case-path.ts +++ b/src/web/case-path.ts @@ -105,8 +105,11 @@ export function blockedReason( // perfectly good linked case: with CODEMAN_CASES_PATH pointing at a broad root such as /mnt/user/Scripts, // refusing everything below it blocked most of the tree. for (const dir of ctx.casesDirs ?? []) { - if (absPath === dir || dirname(absPath) === dir) { - return `That folder is in the cases folder (${dir}), where it is already listed as a case; create it there with plain Create New (no custom folder)`; + if (absPath === dir) { + return `That is the cases folder itself (${dir}); create a case inside it with plain Create New (no custom folder)`; + } + if (dirname(absPath) === dir) { + return `That folder is directly in the cases folder (${dir}), where it is listed as a local case; create it there with plain Create New (no custom folder)`; } } return null; diff --git a/test/case-path.test.ts b/test/case-path.test.ts index 7b267dcd..bd1d8be5 100644 --- a/test/case-path.test.ts +++ b/test/case-path.test.ts @@ -59,6 +59,11 @@ describe('blockedReason', () => { expect(blockedReason('/home/u/codeman-cases', withCases)).toMatch(/plain Create New/); expect(blockedReason('/home/u/codeman-cases/foo', withCases)).toMatch(/plain Create New/); expect(blockedReason('/home/u/codeman-cases/foo', withCases)).toContain('/home/u/codeman-cases'); + // Two messages: the cases folder is not "in" itself, and a child that does not exist yet is not + // "already" listed. + expect(blockedReason('/home/u/codeman-cases', withCases)).toMatch(/cases folder itself/); + expect(blockedReason('/home/u/codeman-cases/foo', withCases)).toMatch(/directly in the cases folder/); + expect(blockedReason('/home/u/codeman-cases/foo', withCases)).not.toMatch(/already/); expect(blockedReason('/home/u/codeman-cases-old/foo', withCases)).toBeNull(); expect(blockedReason('/home/u/codeman-cases/foo', c)).toBeNull(); });