Fix Comments and Audit Trail issue

Fixes #6733
This commit is contained in:
jtkech
2016-05-26 21:51:12 +02:00
committed by Sébastien Ros
parent 7eaaf0d83f
commit b7414e6f42
3 changed files with 14 additions and 4 deletions

View File

@@ -34,7 +34,10 @@ namespace Orchard.AuditTrail.Providers.Content {
protected override void Updating(UpdateContentContext context) {
var contentItem = context.ContentItem;
_ignoreExportHandlerFor = contentItem;
if (contentItem.IsNew())
return;
_ignoreExportHandlerFor = contentItem;
_previousVersionXml = _contentItemCreated
? default(XElement) // No need to do a diff on a newly created content item.
: _contentManager.Export(contentItem);
@@ -43,7 +46,10 @@ namespace Orchard.AuditTrail.Providers.Content {
protected override void Updated(UpdateContentContext context) {
var contentItem = context.ContentItem;
if (contentItem.IsNew())
return;
if (_contentItemCreated) {
RecordAuditTrailEvent(ContentAuditTrailEventProvider.Created, context.ContentItem);
}

View File

@@ -35,7 +35,9 @@ namespace Orchard.AuditTrail.Services {
case XmlNodeType.Element:
var match = reader.GetAttribute("match");
var isAttributeChange = match != null && match.StartsWith("@");
var index = match == null || isAttributeChange ? default(int?) : Int32.Parse(match) - 1;
int matchInt;
var index = match == null || isAttributeChange || !Int32.TryParse(match, out matchInt)
? default(int?) : matchInt - 1;
var diffType = reader.LocalName;
var currentElement = stack.Peek();