File tree Expand file tree Collapse file tree 1 file changed +5
-14
lines changed
src/Umbraco.Cms.Api.Management/Factories Expand file tree Collapse file tree 1 file changed +5
-14
lines changed Original file line number Diff line number Diff line change @@ -27,19 +27,10 @@ private AuditLogResponseModel CreateAuditLogViewModel(IAuditItem auditItem) =>
2727 LogType = auditItem . AuditType ,
2828 Parameters = auditItem . Parameters ,
2929 Timestamp = auditItem . CreateDate ,
30- User = CreateUserReference ( auditItem . UserId ) . GetAwaiter ( ) . GetResult ( ) ,
30+ User = auditItem . UserId switch
31+ {
32+ Constants . Security . UnknownUserId => new ReferenceByIdModel ( ) ,
33+ _ => new ReferenceByIdModel ( _userIdKeyResolver . GetAsync ( auditItem . UserId ) . GetAwaiter ( ) . GetResult ( ) ) ,
34+ } ,
3135 } ;
32-
33- private async Task < ReferenceByIdModel > CreateUserReference ( int userId )
34- {
35- if ( userId == Constants . Security . UnknownUserId )
36- {
37- return new ReferenceByIdModel ( ) ;
38- }
39-
40- Guid userKey = await _userIdKeyResolver . GetAsync ( userId ) ;
41- IUser user = await _userService . GetAsync ( userKey )
42- ?? throw new ArgumentException ( $ "Could not find user with id { userId } ") ;
43- return new ReferenceByIdModel ( user . Key ) ;
44- }
4536}
You can’t perform that action at this time.
0 commit comments