maps avatars in log

This commit is contained in:
Shannon
2017-09-07 22:24:18 +10:00
parent 57a1e73383
commit bc148d08fa
11 changed files with 31 additions and 84 deletions

View File

@@ -24,11 +24,13 @@ namespace Umbraco.Web.Models.Mapping
//for the logging controller (and assuming dashboard that is used in uaas? otherwise not sure what that controller is used for)
config.CreateMap<LogItem, AuditLog>()
.ForMember(log => log.UserAvatar, expression => expression.Ignore())
.ForMember(log => log.UserAvatars, expression => expression.Ignore())
.ForMember(log => log.UserName, expression => expression.Ignore())
.ForMember(log => log.LogType, expression => expression.MapFrom(item => Enum<AuditType>.Parse(item.LogType.ToString())));
config.CreateMap<IAuditItem, AuditLog>()
.ForMember(log => log.UserAvatars, expression => expression.Ignore())
.ForMember(log => log.UserName, expression => expression.Ignore())
.ForMember(log => log.NodeId, expression => expression.MapFrom(item => item.Id))
.ForMember(log => log.Timestamp, expression => expression.MapFrom(item => item.CreateDate))
.ForMember(log => log.LogType, expression => expression.MapFrom(item => item.AuditType));

View File

@@ -231,7 +231,7 @@ namespace Umbraco.Web.Models.Mapping
//Important! Currently we are never mapping to multiple UserDisplay objects but if we start doing that
// this will cause an N+1 and we'll need to change how this works.
config.CreateMap<IUser, UserDisplay>()
.ForMember(detail => detail.Avatars, opt => opt.MapFrom(user => user.GetCurrentUserAvatarUrls(applicationContext.Services.UserService, applicationContext.ApplicationCache.RuntimeCache)))
.ForMember(detail => detail.Avatars, opt => opt.MapFrom(user => user.GetUserAvatarUrls(applicationContext.ApplicationCache.RuntimeCache)))
.ForMember(detail => detail.Username, opt => opt.MapFrom(user => user.Username))
.ForMember(detail => detail.LastLoginDate, opt => opt.MapFrom(user => user.LastLoginDate == default(DateTime) ? null : (DateTime?) user.LastLoginDate))
.ForMember(detail => detail.UserGroups, opt => opt.MapFrom(user => user.Groups))
@@ -292,7 +292,7 @@ namespace Umbraco.Web.Models.Mapping
//like the load time is waiting.
.ForMember(detail =>
detail.Avatars,
opt => opt.MapFrom(user => user.GetCurrentUserAvatarUrls(applicationContext.Services.UserService, applicationContext.ApplicationCache.RuntimeCache)))
opt => opt.MapFrom(user => user.GetUserAvatarUrls(applicationContext.ApplicationCache.RuntimeCache)))
.ForMember(detail => detail.Username, opt => opt.MapFrom(user => user.Username))
.ForMember(detail => detail.UserGroups, opt => opt.MapFrom(user => user.Groups))
.ForMember(detail => detail.LastLoginDate, opt => opt.MapFrom(user => user.LastLoginDate == default(DateTime) ? null : (DateTime?) user.LastLoginDate))
@@ -312,7 +312,7 @@ namespace Umbraco.Web.Models.Mapping
.ForMember(detail => detail.AdditionalData, opt => opt.Ignore());
config.CreateMap<IUser, UserDetail>()
.ForMember(detail => detail.Avatars, opt => opt.MapFrom(user => user.GetCurrentUserAvatarUrls(applicationContext.Services.UserService, applicationContext.ApplicationCache.RuntimeCache)))
.ForMember(detail => detail.Avatars, opt => opt.MapFrom(user => user.GetUserAvatarUrls(applicationContext.ApplicationCache.RuntimeCache)))
.ForMember(detail => detail.UserId, opt => opt.MapFrom(user => GetIntId(user.Id)))
.ForMember(detail => detail.StartContentIds, opt => opt.MapFrom(user => user.CalculateContentStartNodeIds(applicationContext.Services.EntityService)))
.ForMember(detail => detail.StartMediaIds, opt => opt.MapFrom(user => user.CalculateMediaStartNodeIds(applicationContext.Services.EntityService)))