Add user projects view to Site Settings user management#4110
Add user projects view to Site Settings user management#4110
Conversation
Co-authored-by: imnasnainaec <6411521+imnasnainaec@users.noreply.github.com>
Co-authored-by: imnasnainaec <6411521+imnasnainaec@users.noreply.github.com>
Co-authored-by: imnasnainaec <6411521+imnasnainaec@users.noreply.github.com>
|
@copilot Rather than disabling the menu for admins and current user, only disable the delete menu-item. |
…dmins/current user Co-authored-by: imnasnainaec <6411521+imnasnainaec@users.noreply.github.com>
Done in commit 0eeb555. The menu button (⋮) is now enabled for all users, and only the Delete menu item is disabled for admins and the current user. The Projects menu item is always enabled, allowing admins to view user projects even for their own account or other admins. |
|
Important Review skippedBot user detected. To trigger a single review, invoke the You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughThe PR adds a user-projects management feature to site settings, replacing individual delete buttons with an action menu offering "Projects" and "Delete" options. It introduces UserActionsMenu and UserProjects components, refactors UserManagement to handle separate delete and projects modals, and updates ListItemText usage across ProjectUsers components to use children props instead of the primary prop. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #4110 +/- ##
==========================================
- Coverage 74.78% 65.97% -8.82%
==========================================
Files 300 246 -54
Lines 11044 6239 -4805
Branches 1381 790 -591
==========================================
- Hits 8259 4116 -4143
+ Misses 2386 1866 -520
+ Partials 399 257 -142
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@coderabbitai full review |
✅ Actions performedFull review triggered. |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@src/components/SiteSettings/UserManagement/index.tsx`:
- Around line 50-60: Both modal-open handlers share the same openUser state
which can be overwritten if both modals are opened concurrently; update
handleOpenDeleteModal and handleOpenProjectsModal to defensively close the other
modal before opening the target modal (e.g., in handleOpenDeleteModal call
setShowProjectsModal(false) then setOpenUser(user) then
setShowDeleteModal(true), and in handleOpenProjectsModal call
setShowDeleteModal(false) then setOpenUser(user) then
setShowProjectsModal(true)) so the openUser always matches the visible modal.
🧹 Nitpick comments (2)
src/components/SiteSettings/UserManagement/tests/UserProjects.test.tsx (1)
20-25: Fragile CSS class selector for MUI Typography.
[class*="Typography"]depends on MUI's internal class-name generation, which can break across MUI versions or with different styling engines. Consider usingscreen.queryByRoleorscreen.queryByTextinstead, or use MUI'sclassesexport if you need to assert on specific components.For the "renders nothing" case, you could assert that no text content is present at all:
♻️ Suggested alternative
-const typographySelector = '[class*="Typography"]'; - describe("UserProjects", () => { it("renders nothing when no user is provided", async () => { await renderUserProjects(); - expect(document.querySelector(typographySelector)).not.toBeInTheDocument(); + expect(screen.queryByText(/.+/)).not.toBeInTheDocument(); }); it("renders name and username when user is provided", async () => { await renderUserProjects(testUser); - expect(document.querySelector(typographySelector)).toBeInTheDocument(); expect(screen.getByText(new RegExp(testUser.name))).toBeInTheDocument(); expect(screen.getByText(new RegExp(testUser.username))).toBeInTheDocument(); });src/components/SiteSettings/UserManagement/index.tsx (1)
96-103: Projects modal has no explicit close button.Unlike the delete confirmation modal (which has a Cancel button via
ConfirmDeletion), theUserProjectscomponent has no way for the user to dismiss the dialog other than clicking the overlay. Consider adding a close/dismiss button insideUserProjects(or wrapping it here) for better discoverability and accessibility — overlay-click-to-close is easy to miss, especially for keyboard and screen-reader users.
|
Replaced by #4143 |
Updates to User Management in Site Settings (and a few related updates in Project Settings)
UserProjectscomponent to display user's projectsUserActionsMenucomponent to replace the delete buttonUserList.tsxto use the new menu componentUserManagement/index.tsxto support multiple modals (existing Delete modal and new Projects modal)Delete option disabled for current/admin user:

Both options enabled otherwise:

Delete dialog for user with no projects:

Projects dialog for user in both active and archived projects:

Summary
Successfully implemented a menu button (⋮) to replace the delete button in Site Settings user management. The menu provides two options:
Code Quality: All linting checks pass ✅ | All tests pass ✅ | Build successful ✅ | CodeQL scan clean ✅
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.
This change is
Summary by CodeRabbit
New Features
Tests