Fixing an error wrt the home page being unpublished then published through some other means than the page edit UI resulting in a "404" error page

work item: 17003

--HG--
branch : dev
This commit is contained in:
Nathan Heskew
2010-12-10 16:59:28 -08:00
parent b042860645
commit ff2630e741

View File

@@ -52,12 +52,16 @@ namespace Orchard.Core.Routable.Handlers {
Action<PublishContentContext, RoutePart> handler = (context, route) => { Action<PublishContentContext, RoutePart> handler = (context, route) => {
FinalizePath(route, context, processSlug); FinalizePath(route, context, processSlug);
if (route.Id != 0 && route.PromoteToHomePage && _routableHomePageProvider != null) { if (_routableHomePageProvider == null)
return;
var homePageSetting = _workContextAccessor.GetContext().CurrentSite.HomePage; var homePageSetting = _workContextAccessor.GetContext().CurrentSite.HomePage;
var currentHomePageId = !string.IsNullOrWhiteSpace(homePageSetting) var currentHomePageId = !string.IsNullOrWhiteSpace(homePageSetting)
? _routableHomePageProvider.GetHomePageId(homePageSetting) ? _routableHomePageProvider.GetHomePageId(homePageSetting)
: 0; : 0;
if (route.Id != 0 && (route.Id == currentHomePageId || route.PromoteToHomePage)) {
if (currentHomePageId != route.Id) { if (currentHomePageId != route.Id) {
// reset the path on the current home page // reset the path on the current home page
var currentHomePage = _contentManager.Get(currentHomePageId); var currentHomePage = _contentManager.Get(currentHomePageId);