From f1bb89310cfa789f1d4bb2ae2dd2f4ce8fd2761f Mon Sep 17 00:00:00 2001 From: Lombiq Date: Thu, 21 Feb 2019 01:23:39 +0100 Subject: [PATCH] Orchard.Pages: Fixing that the "create page" shouldn't promote a page to home page unless it's also published This prevents SQL timeout and not having a home page content item --- .../Modules/Orchard.Pages/Commands/PageCommands.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Orchard.Web/Modules/Orchard.Pages/Commands/PageCommands.cs b/src/Orchard.Web/Modules/Orchard.Pages/Commands/PageCommands.cs index 620f8fb7c..cbbecf1de 100644 --- a/src/Orchard.Web/Modules/Orchard.Pages/Commands/PageCommands.cs +++ b/src/Orchard.Web/Modules/Orchard.Pages/Commands/PageCommands.cs @@ -99,10 +99,6 @@ namespace Orchard.Pages.Commands { } } - if (Homepage) { - _homeAliasService.PublishHomeAlias(page); - } - var layout = default(string); if (UseWelcomeText) { var text = T( @@ -196,7 +192,7 @@ Aliquam vel sem nibh. Suspendisse vel condimentum tellus.

").Text; } // (Layout) Hackish way to access the LayoutPart on the page without having to declare a dependency on Orchard.Layouts. - var layoutPart = ((dynamic) page).LayoutPart; + var layoutPart = ((dynamic)page).LayoutPart; var bodyPart = page.As(); if (bodyPart != null) @@ -209,6 +205,10 @@ Aliquam vel sem nibh. Suspendisse vel condimentum tellus.

").Text; if (Publish) { _contentManager.Publish(page); + + if (Homepage) { + _homeAliasService.PublishHomeAlias(page); + } } Context.Output.WriteLine(T("Page created successfully.").Text);