Fix user edit modal failing when creator or modifier is soft-deleted#25557
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses an MVC Identity UI bug where opening Users → Edit fails (404) if the edited user’s CreatorId or LastModifierId references a soft-deleted user. It does so by introducing a null-safe “find” API and switching the edit modal to use it so missing audit users render blank instead of breaking the page.
Changes:
- Added
FindByIdAsync(Guid id)toIIdentityUserAppServiceand implemented it inIdentityUserAppService. - Updated the MVC edit modal to resolve
CreatedBy/ModifiedByviaFindByIdAsyncand tolerate missing users. - Updated HTTP API + generated client proxies and added application tests for the new method.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| modules/identity/test/Volo.Abp.Identity.Application.Tests/Volo/Abp/Identity/IdentityUserAppService_Tests.cs | Adds tests validating FindByIdAsync returns user/null (including soft-delete). |
| modules/identity/src/Volo.Abp.Identity.Web/wwwroot/client-proxies/identity-proxy.js | Updates generated JS proxies to include findById. |
| modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/EditModal.cshtml.cs | Switches audit username resolution to null-safe lookup (FindByIdAsync). |
| modules/identity/src/Volo.Abp.Identity.HttpApi/Volo/Abp/Identity/IdentityUserController.cs | Exposes GET api/identity/users/by-id/{id} endpoint. |
| modules/identity/src/Volo.Abp.Identity.HttpApi.Client/ClientProxies/Volo/Abp/Identity/IdentityUserClientProxy.Generated.cs | Updates generated C# client proxy with FindByIdAsync. |
| modules/identity/src/Volo.Abp.Identity.HttpApi.Client/ClientProxies/identity-generate-proxy.json | Updates proxy generation metadata for the new endpoint. |
| modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityUserAppService.cs | Implements FindByIdAsync using UserManager.FindByIdAsync. |
| modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IIdentityUserAppService.cs | Adds FindByIdAsync to the public app service interface. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## rel-10.4 #25557 +/- ##
============================================
- Coverage 49.41% 49.38% -0.04%
============================================
Files 3674 3671 -3
Lines 124021 123853 -168
Branches 9477 9466 -11
============================================
- Hits 61280 61159 -121
+ Misses 60919 60877 -42
+ Partials 1822 1817 -5 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
EngincanV
approved these changes
Jun 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Identity Users edit modal returned 404 when the user's creator or last modifier had been soft-deleted:
GetUserNameOrNullAsynccallsIIdentityUserAppService.GetAsyncwhich throws on a missing user, so opening the modal failed and the error referenced the deleted creator's id instead of the user being edited.Adds
IIdentityUserAppService.FindByIdAsync(null-safe lookup, same pattern asFindByUsernameAsync/FindByEmailAsync) and switches the edit modal to use it. Now a soft-deleted creator/modifier just shows as blank instead of breaking the page.Fixes #25555