Просмотр исходного кода

fix(suggest-path): handle disableUserPages in memo path suggestion

Add disableUserPages branching to Requirement 2 and
MemoSuggestionGenerator design. When user pages are disabled,
the memo suggestion uses an alternative namespace instead of
/user/{username}/memo/. Exact alternative path is pending
confirmation from reviewer.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
VANELLOPE\tomoyuki-t 1 месяц назад
Родитель
Сommit
b152c6f742
2 измененных файлов с 14 добавлено и 11 удалено
  1. 10 8
      .kiro/specs/suggest-path/design.md
  2. 4 3
      .kiro/specs/suggest-path/requirements.md

+ 10 - 8
.kiro/specs/suggest-path/design.md

@@ -161,9 +161,10 @@ sequenceDiagram
 | 1.3 | Path values as directory paths with trailing slash | SuggestPathHandler | PathSuggestion type | — |
 | 1.4 | Separate namespace from /page | SuggestPathRouter | Route registration | — |
 | 2.1 | Include memo type suggestion | MemoSuggestionGenerator | PathSuggestion type | Phase 1 |
-| 2.2 | Memo path from authenticated user | MemoSuggestionGenerator | — | Phase 1 |
-| 2.3 | Memo grant = 4 (owner only) | MemoSuggestionGenerator | — | — |
-| 2.4 | Fixed description for memo | MemoSuggestionGenerator, DescriptionGenerator | — | — |
+| 2.2 | Memo path under user home directory (user pages enabled) | MemoSuggestionGenerator | — | Phase 1 |
+| 2.3 | Memo path under alternative namespace (user pages disabled) | MemoSuggestionGenerator | — | Phase 1 |
+| 2.4 | Memo grant = 4 when user pages enabled; resolve from parent when disabled | MemoSuggestionGenerator, GrantResolver | — | — |
+| 2.5 | Fixed description for memo | MemoSuggestionGenerator, DescriptionGenerator | — | — |
 | 3.1 | Search related pages by keywords | SearchSuggestionGenerator | SearchService | Phase 2 |
 | 3.2 | Return parent directory of most relevant page | SearchSuggestionGenerator | — | Phase 2 |
 | 3.3 | Include related page titles in description | SearchSuggestionGenerator, DescriptionGenerator | — | — |
@@ -290,14 +291,15 @@ interface SuggestPathService {
 | Field | Detail |
 |-------|--------|
 | Intent | Generate personal memo area path suggestion |
-| Requirements | 2.1, 2.2, 2.3, 2.4 |
+| Requirements | 2.1, 2.2, 2.3, 2.4, 2.5 |
 
 **Responsibilities & Constraints**
 
-- Generate path: `/user/{username}/memo/` using `userHomepagePath(user)` utility
-- Set fixed grant value: `PageGrant.GRANT_OWNER` (4)
+- Check `disableUserPages` configuration via `crowi.configManager`
+- When user pages are enabled (default): Generate path `/user/{username}/memo/` using `userHomepagePath(user)` utility, set grant to `PageGrant.GRANT_OWNER` (4)
+- When user pages are disabled: Generate path under alternative namespace (e.g., `/memo/{username}/`), resolve grant from parent page. The exact alternative path is subject to confirmation
 - Set fixed description and label text
-- Always succeeds (no external dependencies)
+- Always succeeds (path can be determined from either configuration)
 
 **Contracts**: Service [x]
 
@@ -310,7 +312,7 @@ function generateMemoSuggestion(user: IUserHasId): PathSuggestion {
 ```
 
 - Preconditions: `user` has valid `username` field
-- Postconditions: Returns a `PathSuggestion` with `type: 'memo'`, `grant: 4`
+- Postconditions: Returns a `PathSuggestion` with `type: 'memo'`. When user pages are enabled, `grant: 4`; when disabled, grant is resolved from the parent page
 
 #### SearchSuggestionGenerator (Phase 2)
 

+ 4 - 3
.kiro/specs/suggest-path/requirements.md

@@ -38,9 +38,10 @@ The following are explicitly **not** part of this feature:
 #### Acceptance Criteria
 
 1. When the client sends a valid request, the Suggest Path Service shall include a suggestion with type `memo`.
-2. The Suggest Path Service shall generate the memo path based on the authenticated user's identity (pattern: `/user/{username}/memo/`).
-3. The Suggest Path Service shall set `grant` to `4` (owner only) for memo type suggestions.
-4. The Suggest Path Service shall provide a fixed descriptive text in the `description` field for memo type suggestions.
+2. When user pages are enabled (default), the Suggest Path Service shall generate the memo path under the user's home directory (pattern: `/user/{username}/memo/`).
+3. When user pages are disabled (`disableUserPages` is true), the Suggest Path Service shall generate the memo path under an alternative namespace (e.g., `/memo/{username}/`). The exact alternative path and grant handling are subject to confirmation.
+4. The Suggest Path Service shall set `grant` to `4` (owner only) for memo type suggestions when using the user home directory path.
+5. The Suggest Path Service shall provide a fixed descriptive text in the `description` field for memo type suggestions.
 
 ### Requirement 3: Search-Based Path Suggestion (Phase 2)