From bbd5dcc8d4dd5efe2ebb133e38ffdd274a558f2e Mon Sep 17 00:00:00 2001 From: Kan Ma Date: Wed, 25 Jan 2017 15:31:49 -0800 Subject: [PATCH] DNN-9299: Fixed localized page publishing issue --- .../Entities/Modules/ModuleController.cs | 21 +++++++++++++++---- .../Tabs/TabVersions/TabVersionTracker.cs | 12 +++++++---- 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/DNN Platform/Library/Entities/Modules/ModuleController.cs b/DNN Platform/Library/Entities/Modules/ModuleController.cs index 00e6d25d65d..b92b1121283 100644 --- a/DNN Platform/Library/Entities/Modules/ModuleController.cs +++ b/DNN Platform/Library/Entities/Modules/ModuleController.cs @@ -652,8 +652,10 @@ private int LocalizeModuleInternal(ModuleInfo sourceModule) newModule.CultureCode, currentUser.UserID); - //Copy each setting to the new TabModule instance - foreach (DictionaryEntry setting in settings) + DataCache.RemoveCache(string.Format(DataCache.SingleTabModuleCacheKey, newModule.TabModuleID)); + + //Copy each setting to the new TabModule instance + foreach (DictionaryEntry setting in settings) { UpdateModuleSetting(newModule.ModuleID, Convert.ToString(setting.Key), Convert.ToString(setting.Value)); } @@ -831,7 +833,8 @@ private void DeleteTabModuleInternal(ModuleInfo moduleInfo, bool softDelete, boo //hard delete the module DeleteModule(moduleInfo.ModuleID); } - + + DataCache.RemoveCache(string.Format(DataCache.SingleTabModuleCacheKey, moduleInfo.TabModuleID)); ClearCache(moduleInfo.TabID); } } @@ -1345,6 +1348,13 @@ public int DeLocalizeModule(ModuleInfo sourceModule) newModule.CultureCode, UserController.Instance.GetCurrentUserInfo().UserID); + DataCache.RemoveCache(string.Format(DataCache.SingleTabModuleCacheKey, newModule.TabModuleID)); + + //Update tab version details of old and new modules + var userId = UserController.Instance.GetCurrentUserInfo().UserID; + TabChangeTracker.Instance.TrackModuleDeletion(sourceModule, Null.NullInteger, userId); + TabChangeTracker.Instance.TrackModuleCopy(newModule, Null.NullInteger, newModule.TabID, userId); + //check if all modules instances have been deleted if (GetModule(sourceModule.ModuleID, Null.NullInteger, true).TabID == Null.NullInteger) { @@ -1888,6 +1898,8 @@ public void UpdateModule(ModuleInfo module) module.CultureCode, currentUser.UserID); + DataCache.RemoveCache(string.Format(DataCache.SingleTabModuleCacheKey, module.TabModuleID)); + EventLogController.Instance.AddLog(module, PortalController.Instance.GetCurrentPortalSettings(), currentUser.UserID, "", EventLogController.EventLogType.TABMODULE_UPDATED); if (hasModuleOrderOrPaneChanged) @@ -1963,7 +1975,8 @@ public void UpdateModule(ModuleInfo module) targetModule.CultureCode, currentUser.UserID); - ClearCache(targetModule.TabID); + DataCache.RemoveCache(string.Format(DataCache.SingleTabModuleCacheKey, targetModule.TabModuleID)); + ClearCache(targetModule.TabID); } } } diff --git a/DNN Platform/Library/Entities/Tabs/TabVersions/TabVersionTracker.cs b/DNN Platform/Library/Entities/Tabs/TabVersions/TabVersionTracker.cs index 79be665d284..f3f11ba5d2a 100644 --- a/DNN Platform/Library/Entities/Tabs/TabVersions/TabVersionTracker.cs +++ b/DNN Platform/Library/Entities/Tabs/TabVersions/TabVersionTracker.cs @@ -229,10 +229,14 @@ private static void ProcessDeletionDetail(ModuleInfo module, int moduleVersion, } } - var tabVersionDetail = CreateNewTabVersionDetailObjectFromModule(targetVersion.TabVersionId, module, - moduleVersion, TabVersionDetailAction.Deleted); - TabVersionDetailController.Instance.SaveTabVersionDetail(tabVersionDetail, userId); - + //Do not add module to Tab Version Details if it has been hard deleted + ModuleInfo moduleInfo = ModuleController.Instance.GetModule(module.ModuleID, module.TabID, false); + if (moduleInfo != null) + { + var tabVersionDetail = CreateNewTabVersionDetailObjectFromModule(targetVersion.TabVersionId, module, + moduleVersion, TabVersionDetailAction.Deleted); + TabVersionDetailController.Instance.SaveTabVersionDetail(tabVersionDetail, userId); + } } private static bool IsHostModule(ModuleInfo module)