mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-04-05 21:01:35 +08:00
#18505: Fields could not be imported in setup recipes
Work Item: 18505 --HG-- branch : 1.x
This commit is contained in:
parent
4d5ef16ee0
commit
a361ad263e
@ -91,6 +91,7 @@ namespace Orchard.Tests.Modules.Comments.Services {
|
||||
|
||||
}
|
||||
|
||||
_contentManager.Flush();
|
||||
Assert.That(_commentService.GetComments().Count(), Is.EqualTo(12));
|
||||
}
|
||||
|
||||
@ -180,11 +181,15 @@ namespace Orchard.Tests.Modules.Comments.Services {
|
||||
commentIds[i] = commentedItem.As<CommentPart>().Id;
|
||||
}
|
||||
|
||||
_contentManager.Flush();
|
||||
Assert.That(_commentService.GetComments().Count(), Is.EqualTo(12));
|
||||
|
||||
for (int i = 0; i < 12; 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) {
|
||||
// produce root record to determine the model id
|
||||
contentItem.VersionRecord = new ContentItemVersionRecord {
|
||||
ContentItemRecord = new ContentItemRecord {
|
||||
ContentType = AcquireContentTypeRecord(contentItem.ContentType)
|
||||
},
|
||||
Number = 1,
|
||||
Latest = true,
|
||||
Published = true
|
||||
};
|
||||
if (contentItem.VersionRecord == null) {
|
||||
// produce root record to determine the model id
|
||||
contentItem.VersionRecord = new ContentItemVersionRecord {
|
||||
ContentItemRecord = new ContentItemRecord {
|
||||
ContentType = AcquireContentTypeRecord(contentItem.ContentType)
|
||||
},
|
||||
Number = 1,
|
||||
Latest = true,
|
||||
Published = true
|
||||
};
|
||||
}
|
||||
|
||||
// add to the collection manually for the created case
|
||||
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);
|
||||
|
||||
var context = new ImportContentContext(item, element, importContentSession);
|
||||
|
Loading…
Reference in New Issue
Block a user