feat(spx-gui): add username modification to profile editing#2903
feat(spx-gui): add username modification to profile editing#2903aofei wants to merge 1 commit intogoplus:devfrom
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
f2e5536 to
bb7ac3f
Compare
| if (trimmed.length > 100) | ||
| return t({ | ||
| en: 'The username is too long (maximum is 100 characters)', | ||
| zh: '用户名长度超出限制(最多 100 个字符)' |
There was a problem hiding this comment.
我们其实还没限制过 username 的长度,因为后端认为直接从 idp 那边拿的 username 都是可信的,所以就没加任何校验逻辑
感觉还是要限制一下,我先按照跟 project name 相同的长度来了,不过对 username 来说可能不太合理,我在纠结多少合适
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
Summary of ChangesThis pull request introduces the capability for users to modify their usernames, enhancing user account management. It establishes a robust and user-friendly workflow for this sensitive operation, ensuring data integrity through comprehensive validation and consistent application state. The changes streamline the user experience by providing clear warnings about the impacts of a username change and dynamically updating relevant parts of the application, such as routing and cached user data. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
|
|
Clean two-step flow with good separation of concerns. The
|
There was a problem hiding this comment.
Pull request overview
Adds a two-step username modification flow to the profile editing experience in spx-gui, including a shared warning modal and associated state/cache updates.
Changes:
- Introduces a reusable
ModificationWarningModaland wires it into project rename + username modification flows. - Adds username modification UI (warning step + input/validation modal) and integrates it into
EditProfileModal. - Extends user store/API/OpenAPI to support updating and caching
username, plus query invalidation for old/new usernames.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| spx-gui/src/stores/user/signed-in.ts | Cache username in user state; add helper to modify username and invalidate old/new user query keys. |
| spx-gui/src/components/project/index.ts | Switch project rename warning to shared ModificationWarningModal with configurable content. |
| spx-gui/src/components/community/user/index.ts | Add useModifyUsername hook to run warning step then open username modification modal. |
| spx-gui/src/components/community/user/UserHeader.vue | After edit flow completes, replace current route when username changes (preserving suffix/query/hash). |
| spx-gui/src/components/community/user/ModifyUsernameModal.vue | New modal to validate and submit username changes (format/length/dup-check). |
| spx-gui/src/components/community/user/EditProfileUsernameField.vue | Extract username field into a dedicated component that triggers the modify flow. |
| spx-gui/src/components/community/user/EditProfileModal.vue | Embed the extracted username field into profile editing modal. |
| spx-gui/src/components/common/ModificationWarningModal.vue | Generalize warning modal props for reuse across different modification flows. |
| spx-gui/src/apis/user.ts | Extend UpdateSignedInUserParams to allow username updates. |
| docs/openapi.yaml | Add username to PATCH /user request body schema. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
There was a problem hiding this comment.
Code Review
This pull request introduces a feature to modify usernames within the profile editing section. The implementation includes a two-step modification flow with a warning modal, validation for the new username, and updates to the API and frontend state management.
The refactoring of the warning modal into a reusable component is a good improvement. The logic for updating the URL after a username change and for managing cache invalidation is also well-handled.
I've identified a potential data loss issue in the profile edit modal and a point for improving user experience and code simplification in the username modification modal. My comments provide specific suggestions to address these points.
Add a two-step username modification flow to profile editing. - Add `ModifyUsernameModal` with validation for allowed characters, length limit, and duplicate usernames via `getUser` - Reuse a shared `ModificationWarningModal` for username and project rename impact warnings - Extract the username field in `EditProfileModal` into a dedicated component while keeping profile form orchestration in the parent - Update the current user route after a username change while preserving the active path suffix, query, and hash - Add `username` to `UpdateSignedInUserParams` and to the API spec `PATCH /user` request body - Cache `username` in `userState` and add a dedicated `useModifySignedInUsername` helper to invalidate old and new username query keys Signed-off-by: Aofei Sheng <aofei@aofeisheng.com>
Add a two-step username modification flow to profile editing.
ModifyUsernameModalwith validation for allowed characters, length limit, and duplicate usernames viagetUserModificationWarningModalfor username and project rename impact warningsEditProfileModalinto a dedicated component while keeping profile form orchestration in the parentusernametoUpdateSignedInUserParamsand to the API specPATCH /userrequest bodyusernameinuserStateand add a dedicateduseModifySignedInUsernamehelper to invalidate old and new username query keys