Open orchardbot opened 9 years ago
@StanleyGoldman commented:
@sebastienros commented:
If I understand correctly, it has PublishLaterPart but because it's not draftable it should be published right now, but having PublishLaterPart conflicts and creates a draft ?
If this is the case, maybe there should be a warning in the editor when PublishLaterPart is attached to a type which is not draftable.
@StanleyGoldman commented:
In the editor upon creating an instance of said ContentItem?
@StanleyGoldman commented:
I can add that to the pull request a bit later tonight.
@sebastienros commented:
please do
@StanleyGoldman commented:
And I have one more question...
Based on this conversation, I think the boolean condition above should change. Currently, even though the ContentItem is not Draftable, the bug leaves the ContentItem in a draft state.
So, what should become of the ContentItem? Should we publish it or leave it as a draft? And what if they set a time in PublishLaterPart?
@sebastienros commented:
If not draftable, the draft should be removed.
If it's not draftable we should not take the PublishLaterPart into account, and display the warning.
@StanleyGoldman commented:
@StanleyGoldman created: https://orchard.codeplex.com/workitem/20845
Repro Steps: Cook Core Recipe Modify Page ContentItem defintion to remove Draftable Create a New Page Hit Save Observe that the page is drafted, not published
The Issue is because of the faulty logic around the usage of IPublishingControlAspect. The EditPost method of \src\Orchard.Web\Core\Contents\Controllers\AdminController.cs [HttpPost, ActionName("Edit")] [Mvc.FormValueRequired("submit.Save")] public ActionResult EditPOST(int id, string returnUrl) { return EditPOST(id, returnUrl, contentItem => { if (!contentItem.Has() && !contentItem.TypeDefinition.Settings.GetModel().Draftable)
_contentManager.Publish(contentItem);
});
}
Should read like such... var isDraftable = contentItem.TypeDefinition.Settings.GetModel().Draftable;
var scheduledToPublishLater = contentItem.Has() && contentItem.As().ScheduledPublishUtc.Value.HasValue;
if (!isDraftable && !scheduledToPublishLater) { ... }