mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-12-19 19:57:01 +08:00
#18505: Fields could not be imported in setup recipes
Work Item: 18505 --HG-- branch : 1.x
This commit is contained in:
@@ -91,6 +91,7 @@ namespace Orchard.Tests.Modules.Comments.Services {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_contentManager.Flush();
|
||||||
Assert.That(_commentService.GetComments().Count(), Is.EqualTo(12));
|
Assert.That(_commentService.GetComments().Count(), Is.EqualTo(12));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -180,11 +181,15 @@ namespace Orchard.Tests.Modules.Comments.Services {
|
|||||||
commentIds[i] = commentedItem.As<CommentPart>().Id;
|
commentIds[i] = commentedItem.As<CommentPart>().Id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_contentManager.Flush();
|
||||||
Assert.That(_commentService.GetComments().Count(), Is.EqualTo(12));
|
Assert.That(_commentService.GetComments().Count(), Is.EqualTo(12));
|
||||||
|
|
||||||
for (int i = 0; i < 12; i++) {
|
for (int i = 0; i < 12; i++) {
|
||||||
_commentService.DeleteComment(commentIds[i]);
|
_commentService.DeleteComment(commentIds[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_contentManager.Flush();
|
||||||
|
Assert.That(_commentService.GetComments().Count(), Is.EqualTo(0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -439,15 +439,18 @@ namespace Orchard.ContentManagement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public virtual void Create(ContentItem contentItem, VersionOptions options) {
|
public virtual void Create(ContentItem contentItem, VersionOptions options) {
|
||||||
// produce root record to determine the model id
|
if (contentItem.VersionRecord == null) {
|
||||||
contentItem.VersionRecord = new ContentItemVersionRecord {
|
// produce root record to determine the model id
|
||||||
ContentItemRecord = new ContentItemRecord {
|
contentItem.VersionRecord = new ContentItemVersionRecord {
|
||||||
ContentType = AcquireContentTypeRecord(contentItem.ContentType)
|
ContentItemRecord = new ContentItemRecord {
|
||||||
},
|
ContentType = AcquireContentTypeRecord(contentItem.ContentType)
|
||||||
Number = 1,
|
},
|
||||||
Latest = true,
|
Number = 1,
|
||||||
Published = true
|
Latest = true,
|
||||||
};
|
Published = true
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
// add to the collection manually for the created case
|
// add to the collection manually for the created case
|
||||||
contentItem.VersionRecord.ContentItemRecord.Versions.Add(contentItem.VersionRecord);
|
contentItem.VersionRecord.ContentItemRecord.Versions.Add(contentItem.VersionRecord);
|
||||||
|
|
||||||
@@ -574,6 +577,18 @@ namespace Orchard.ContentManagement {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// create a version record if import handlers need it
|
||||||
|
if(item.VersionRecord == null) {
|
||||||
|
item.VersionRecord = new ContentItemVersionRecord {
|
||||||
|
ContentItemRecord = new ContentItemRecord {
|
||||||
|
ContentType = AcquireContentTypeRecord(item.ContentType)
|
||||||
|
},
|
||||||
|
Number = 1,
|
||||||
|
Latest = true,
|
||||||
|
Published = true
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
importContentSession.Store(identity, item);
|
importContentSession.Store(identity, item);
|
||||||
|
|
||||||
var context = new ImportContentContext(item, element, importContentSession);
|
var context = new ImportContentContext(item, element, importContentSession);
|
||||||
|
|||||||
Reference in New Issue
Block a user