mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-22 03:37:25 +08:00
#19541: Adding null check for Owner in CommonPartHandler OnIndexing
Work Item: 19541 --HG-- branch : 1.x
This commit is contained in:
@@ -48,13 +48,15 @@ namespace Orchard.Core.Common.Handlers {
|
||||
|
||||
OnPublishing<CommonPart>(AssignPublishingDates);
|
||||
|
||||
OnIndexing<CommonPart>((context, commonPart) => context.DocumentIndex
|
||||
.Add("type", commonPart.ContentItem.ContentType).Analyze().Store()
|
||||
.Add("author", commonPart.Owner.UserName).Analyze().Store()
|
||||
.Add("created", commonPart.CreatedUtc ?? _clock.UtcNow).Store()
|
||||
.Add("published", commonPart.PublishedUtc ?? _clock.UtcNow).Store()
|
||||
.Add("modified", commonPart.ModifiedUtc ?? _clock.UtcNow).Store()
|
||||
);
|
||||
OnIndexing<CommonPart>((context, commonPart) => {
|
||||
context.DocumentIndex
|
||||
.Add("type", commonPart.ContentItem.ContentType).Analyze().Store()
|
||||
.Add("created", commonPart.CreatedUtc ?? _clock.UtcNow).Store()
|
||||
.Add("published", commonPart.PublishedUtc ?? _clock.UtcNow).Store()
|
||||
.Add("modified", commonPart.ModifiedUtc ?? _clock.UtcNow).Store();
|
||||
|
||||
if (commonPart.Owner != null) context.DocumentIndex.Add("author", commonPart.Owner.UserName).Analyze().Store();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user