#3916 fix multiple enumerations of ienumerable...so usernames and avatars are displayed correctly
This commit is contained in:
committed by
Sebastiaan Janssen
parent
0ce54847b0
commit
ee8b4c5884
@@ -85,16 +85,17 @@ namespace Umbraco.Web.Editors
|
||||
|
||||
private IEnumerable<AuditLog> MapAvatarsAndNames(IEnumerable<AuditLog> items)
|
||||
{
|
||||
var userIds = items.Select(x => x.UserId).ToArray();
|
||||
var mappedItems = items.ToList();
|
||||
var userIds = mappedItems.Select(x => x.UserId).ToArray();
|
||||
var users = Services.UserService.GetUsersById(userIds)
|
||||
.ToDictionary(x => x.Id, x => x.GetUserAvatarUrls(ApplicationContext.ApplicationCache.RuntimeCache));
|
||||
var userNames = Services.UserService.GetUsersById(userIds).ToDictionary(x => x.Id, x => x.Name);
|
||||
foreach (var item in items)
|
||||
foreach (var item in mappedItems)
|
||||
{
|
||||
item.UserAvatars = users[item.UserId];
|
||||
item.UserName = userNames[item.UserId];
|
||||
}
|
||||
return items;
|
||||
return mappedItems;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user