[SiteSettings > UserManagament > ConfirmDeletion] Refactor#4136
[SiteSettings > UserManagament > ConfirmDeletion] Refactor#4136imnasnainaec merged 6 commits intomasterfrom
Conversation
📝 WalkthroughWalkthroughAdds a new ProjectVernacular field to user project data (backend and frontend), introduces a UserProjectsList component that fetches/sorts projects and signals readiness, updates ConfirmDeletion to use the new component and prop-driven deletion, adds sorting utility and tests for both components. Changes
Sequence Diagram(s)sequenceDiagram
participant Confirm as "ConfirmDeletion\n(component)"
participant List as "UserProjectsList\n(component)"
participant API as "getUserProjects\n(API)"
participant Toast as "Toast\n(notification)"
Note over Confirm,List: User modal opens
Confirm->>List: mount with userId
List->>API: getUserProjects(userId)
API-->>List: projects[]
alt fetch success
List->>List: sort projects (compareUserProjectInfo)
List-->>Confirm: onLoaded()
List-->>Confirm: render project items
else fetch error
List->>Toast: show warning
List-->>Confirm: onLoaded()
end
Confirm->>Confirm: enable Delete button (once loaded)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 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 #4136 +/- ##
==========================================
+ Coverage 74.76% 74.87% +0.11%
==========================================
Files 295 298 +3
Lines 10958 10971 +13
Branches 1371 1375 +4
==========================================
+ Hits 8193 8215 +22
+ Misses 2368 2357 -11
- Partials 397 399 +2
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:
|
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
Backend/Controllers/UserController.cs (1)
256-262:⚠️ Potential issue | 🟠 MajorAvoid possible null dereference when reading
VernacularWritingSystem.
Line 261 can throw ifproject.VernacularWritingSystemis null, which would fail the whole request. Use a null-safe fallback.🛠️ Suggested fix
- ProjectVernacular = project.VernacularWritingSystem.Bcp47, + ProjectVernacular = project.VernacularWritingSystem?.Bcp47 ?? "",
🤖 Fix all issues with AI agents
In `@src/components/SiteSettings/UserManagement/ConfirmDeletion.tsx`:
- Line 46: The inline arrow passed to UserProjectsList as onLoaded creates a new
function each render causing UserProjectsList's effect to re-run; fix by
memoizing the callback in this component (import useCallback) and replace the
inline onLoaded={() => setLoaded(true)} with a stable handler like const
handleLoaded = useCallback(() => setLoaded(true), [setLoaded]) and pass
onLoaded={handleLoaded} so the prop reference stays stable across renders.
🧹 Nitpick comments (1)
src/components/SiteSettings/UserManagement/ConfirmDeletion.tsx (1)
64-64: Nitpick: Simplify the cancel button handler.The wrapper function is unnecessary since
handleCloseModaltakes no arguments.♻️ Suggested simplification
- onClick={() => props.handleCloseModal()} + onClick={props.handleCloseModal}
|
a class comment describing how this sorts or a more descriptive name would be good. |
jasonleenaylor
left a comment
There was a problem hiding this comment.
@jasonleenaylor reviewed 8 files and all commit messages, and made 1 comment.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @imnasnainaec).
Depends on #4133Part of #4110
User w/o projects:

User w/ projects:

This change is
Summary by CodeRabbit
New Features
Improvements
Tests