Merge pull request #6075 from sbwalker/dev

do not display audit info when copying pages
This commit is contained in:
Shaun Walker
2026-02-25 09:46:22 -05:00
committed by GitHub
2 changed files with 41 additions and 26 deletions

View File

@@ -225,7 +225,10 @@
<button type="button" class="btn btn-secondary" @onclick="Cancel">@SharedLocalizer["Cancel"]</button> <button type="button" class="btn btn-secondary" @onclick="Cancel">@SharedLocalizer["Cancel"]</button>
<br /> <br />
<br /> <br />
@if (!_copy)
{
<AuditInfo CreatedBy="@_createdby" CreatedOn="@_createdon" ModifiedBy="@_modifiedby" ModifiedOn="@_modifiedon" DeletedBy="@_deletedby" DeletedOn="@_deletedon"></AuditInfo> <AuditInfo CreatedBy="@_createdby" CreatedOn="@_createdon" ModifiedBy="@_modifiedby" ModifiedOn="@_modifiedon" DeletedBy="@_deletedby" DeletedOn="@_deletedon"></AuditInfo>
}
</TabPanel> </TabPanel>
<TabPanel Name="Permissions" ResourceKey="Permissions" Heading="Permissions"> <TabPanel Name="Permissions" ResourceKey="Permissions" Heading="Permissions">
<div class="container"> <div class="container">

View File

@@ -513,7 +513,13 @@ namespace Oqtane.Controllers
List<PageModule> pageModules = _pageModules.GetPageModules(fromPage.SiteId).ToList(); List<PageModule> pageModules = _pageModules.GetPageModules(fromPage.SiteId).ToList();
foreach (PageModule pm in pageModules.Where(item => item.PageId == fromPage.PageId && !item.Module.AllPages && !item.IsDeleted)) foreach (PageModule pm in pageModules.Where(item => item.PageId == fromPage.PageId && !item.Module.AllPages && !item.IsDeleted))
{ {
Module module = new Module(); Module module;
// determine if module is a shared instance (ie. exists on other pages)
if (!pageModules.Any(item => item.ModuleId == pm.ModuleId && item.PageId != fromPage.PageId))
{
// create new module
module = new Module();
module.SiteId = fromPage.SiteId; module.SiteId = fromPage.SiteId;
module.PageId = toPageId; module.PageId = toPageId;
module.ModuleDefinitionName = pm.Module.ModuleDefinitionName; module.ModuleDefinitionName = pm.Module.ModuleDefinitionName;
@@ -536,13 +542,19 @@ namespace Oqtane.Controllers
UserId = item.UserId, UserId = item.UserId,
IsAuthorized = item.IsAuthorized, IsAuthorized = item.IsAuthorized,
}).ToList(); }).ToList();
module = _modules.AddModule(module);
module = _modules.AddModule(module);
string content = _modules.ExportModule(pm.ModuleId); string content = _modules.ExportModule(pm.ModuleId);
if (content != "") if (content != "")
{ {
_modules.ImportModule(module.ModuleId, content); _modules.ImportModule(module.ModuleId, content);
} }
}
else
{
// use existing module
module = pm.Module;
}
PageModule pageModule = new PageModule(); PageModule pageModule = new PageModule();
pageModule.PageId = toPageId; pageModule.PageId = toPageId;