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