From 42902497194a258cde1444c43849410225b34f5d Mon Sep 17 00:00:00 2001 From: Bjarke Berg Date: Tue, 5 Feb 2019 11:55:10 +0100 Subject: [PATCH] #4405 - Load history on init if the active tab is info --- .../content/umbcontentnodeinfo.directive.js | 26 ++++++++----------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/content/umbcontentnodeinfo.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/content/umbcontentnodeinfo.directive.js index 06a147969a..a043b292ef 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/content/umbcontentnodeinfo.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/content/umbcontentnodeinfo.directive.js @@ -3,7 +3,7 @@ function ContentNodeInfoDirective($timeout, logResource, eventsService, userService, localizationService, dateHelper, editorService, redirectUrlsResource, overlayService) { - function link(scope, umbVariantContentCtrl) { + function link(scope) { var evts = []; var isInfoTab = false; @@ -96,22 +96,17 @@ scope.previewOpenUrl = '#/settings/documenttypes/edit/' + scope.documentType.id; } - //load in the audit trail if we are currently looking at the INFO tab - if (umbVariantContentCtrl && umbVariantContentCtrl.editor) { - var activeApp = _.find(umbVariantContentCtrl.editor.content.apps, a => a.active); - if (activeApp && activeApp.alias === "umbInfo") { - isInfoTab = true; - loadAuditTrail(); - loadRedirectUrls(); - } + var activeApp = _.find(scope.node.apps, (a) => a.active); + if (activeApp.alias === "umbInfo") { + loadRedirectUrls(); + loadAuditTrail(); } } scope.auditTrailPageChange = function (pageNumber) { scope.auditTrailOptions.pageNumber = pageNumber; - auditTrailLoaded = false; - loadAuditTrail(); + loadAuditTrail(true); }; scope.openDocumentType = function (documentType) { @@ -192,10 +187,12 @@ editorService.rollback(rollback); }; - function loadAuditTrail() { + function loadAuditTrail(forceReload) { //don't load this if it's already done - if (auditTrailLoaded) { return; }; + if (auditTrailLoaded && !forceReload) { + return; + } scope.loadingAuditTrail = true; @@ -334,8 +331,7 @@ if (newValue === oldValue) { return; } if (isInfoTab) { - auditTrailLoaded = false; - loadAuditTrail(); + loadAuditTrail(true); loadRedirectUrls(); setNodePublishStatus(); updateCurrentUrls();