tju-yxq opened a new pull request, #5164:
URL: https://github.com/apache/rocketmq-dashboard/pull/5164
### Which Issue(s) This PR Fixes
- Fixes #5163
### Brief Description
Custom prompt templates move from one global `localStorage` key to an
account-scoped key derived from the signed-in user (`userId`, falling back to
the username). The template modal passes the owner from `useAuthStore` through
`loadPromptTemplateCatalog` / `saveCustomPromptTemplate` /
`deleteCustomPromptTemplate`, so each account sees and edits only its own
snippets. The ownerless legacy key migrates to the scoped key only in
unauthenticated single-user mode; for authenticated accounts it is cleared
rather than assigned, so the cross-account disclosure cannot survive the
upgrade. The corrupt-JSON repair behaviour from #4575 is preserved on the
scoped keys, and the rebase onto current `master` re-targets the wiring at the
`PromptTemplateModal` component extracted by the #4606 conversation-platform
refactor.
### How Did You Test This Change?
Run on the branch (`cd3ca43c`, based on `master` @ `0228dad5`):
```
cd web && npm test -- promptTemplates AiPage --run
Test Files 2 passed (2)
Tests 30 passed (30)
cd web && npm run lint
0 errors (11 pre-existing warnings in unrelated files)
```
The `promptTemplates` suite covers: per-user isolation (alice saves, bob's
catalog stays empty), the legacy key not being assigned to the first
authenticated account, the legacy migration in unauthenticated single-user
mode, and the #4575 corrupt-JSON repair on the scoped key. The `AiPage` suite
covers the page-level flows including the prompt template modal.
### Checklist
- [x] One coherent change; unrelated modifications are not bundled in
- [x] Commit subject follows Conventional Commits
- [x] Tests added or updated for non-trivial changes, test methods named
`...Test`
- [x] New UI text has both Chinese and English entries under `web/src/i18n/`
- [x] Architecture constraints stay green (`mvn test` runs the ArchUnit
checks)
- [x] New source files carry the ASF license header
- [ ] Documentation touched where behaviour changed (README / `docs/` /
in-app help)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]