fix #2938 - path not updated correctly when parent page changed
This commit is contained in:
parent
60b6a9ce47
commit
e1a8d3db54
|
@ -603,16 +603,6 @@
|
||||||
await PageService.UpdatePageOrderAsync(_page.SiteId, _page.PageId, int.Parse(_currentparentid));
|
await PageService.UpdatePageOrderAsync(_page.SiteId, _page.PageId, int.Parse(_currentparentid));
|
||||||
}
|
}
|
||||||
|
|
||||||
// update child paths
|
|
||||||
if (_parentid != _currentparentid)
|
|
||||||
{
|
|
||||||
foreach (Page p in PageState.Pages.Where(item => item.Path.StartsWith(currentPath)))
|
|
||||||
{
|
|
||||||
p.Path = p.Path.Replace(currentPath, _page.Path);
|
|
||||||
await PageService.UpdatePageAsync(p);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_themeSettingsType != null && _themeSettings is ISettingsControl themeSettingsControl)
|
if (_themeSettingsType != null && _themeSettings is ISettingsControl themeSettingsControl)
|
||||||
{
|
{
|
||||||
await themeSettingsControl.UpdateSettings();
|
await themeSettingsControl.UpdateSettings();
|
||||||
|
|
|
@ -12,6 +12,8 @@ using Oqtane.Infrastructure;
|
||||||
using Oqtane.Repository;
|
using Oqtane.Repository;
|
||||||
using Oqtane.Modules.Admin.Users;
|
using Oqtane.Modules.Admin.Users;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using Oqtane.Services;
|
||||||
|
using Oqtane.UI;
|
||||||
|
|
||||||
namespace Oqtane.Controllers
|
namespace Oqtane.Controllers
|
||||||
{
|
{
|
||||||
|
@ -263,14 +265,18 @@ namespace Oqtane.Controllers
|
||||||
// save url mapping if page path changed
|
// save url mapping if page path changed
|
||||||
if (currentPage.Path != page.Path)
|
if (currentPage.Path != page.Path)
|
||||||
{
|
{
|
||||||
var urlMapping = new UrlMapping();
|
var urlMapping = _urlMappings.GetUrlMapping(page.SiteId, currentPage.Path);
|
||||||
urlMapping.SiteId = page.SiteId;
|
if (urlMapping == null)
|
||||||
urlMapping.Url = currentPage.Path;
|
{
|
||||||
urlMapping.MappedUrl = page.Path;
|
urlMapping = new UrlMapping();
|
||||||
urlMapping.Requests = 0;
|
urlMapping.SiteId = page.SiteId;
|
||||||
urlMapping.CreatedOn = System.DateTime.UtcNow;
|
urlMapping.Url = currentPage.Path;
|
||||||
urlMapping.RequestedOn = System.DateTime.UtcNow;
|
urlMapping.MappedUrl = page.Path;
|
||||||
_urlMappings.AddUrlMapping(urlMapping);
|
urlMapping.Requests = 0;
|
||||||
|
urlMapping.CreatedOn = System.DateTime.UtcNow;
|
||||||
|
urlMapping.RequestedOn = System.DateTime.UtcNow;
|
||||||
|
_urlMappings.AddUrlMapping(urlMapping);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// get differences between current and new page permissions
|
// get differences between current and new page permissions
|
||||||
|
@ -314,6 +320,16 @@ namespace Oqtane.Controllers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// update child paths
|
||||||
|
if (page.ParentId != currentPage.ParentId)
|
||||||
|
{
|
||||||
|
foreach (Page _page in _pages.GetPages(page.SiteId).Where(item => item.Path.StartsWith(currentPage.Path)).ToList())
|
||||||
|
{
|
||||||
|
_page.Path = _page.Path.Replace(currentPage.Path, page.Path);
|
||||||
|
_pages.UpdatePage(_page);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
_syncManager.AddSyncEvent(_alias.TenantId, EntityNames.Page, page.PageId, SyncEventActions.Update);
|
_syncManager.AddSyncEvent(_alias.TenantId, EntityNames.Page, page.PageId, SyncEventActions.Update);
|
||||||
_syncManager.AddSyncEvent(_alias.TenantId, EntityNames.Site, page.SiteId, SyncEventActions.Refresh);
|
_syncManager.AddSyncEvent(_alias.TenantId, EntityNames.Site, page.SiteId, SyncEventActions.Refresh);
|
||||||
_logger.Log(LogLevel.Information, this, LogFunction.Update, "Page Updated {Page}", page);
|
_logger.Log(LogLevel.Information, this, LogFunction.Update, "Page Updated {Page}", page);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user