From adf0f102cc7a04cf8fcac8743801d48214118cad Mon Sep 17 00:00:00 2001 From: Russell Michell Date: Fri, 9 Jan 2015 11:16:00 +1300 Subject: [PATCH 1/3] FIX: Fixes CMS errors when viewing history on "Deleted" pages. Fixes undocumented error when viewing history tab of deleted pages with no history. Related to silverstripe/silverstripe/cms#1054 (See silverstripe/silverstripe-cms/pull/1149). --- model/Versioned.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/model/Versioned.php b/model/Versioned.php index 6dbfe57e1..6e0f09412 100644 --- a/model/Versioned.php +++ b/model/Versioned.php @@ -1249,8 +1249,11 @@ class Versioned extends DataExtension implements TemplateGlobalProvider { */ public function isLatestVersion() { $version = self::get_latest_version($this->owner->class, $this->owner->ID); + if($version) { + return ($version->Version == $this->owner->Version); + } - return ($version->Version == $this->owner->Version); + return false; } /** From fde6376996dbaba31601065869c60676845eeb85 Mon Sep 17 00:00:00 2001 From: Daniel Hensby Date: Sun, 24 Apr 2016 08:57:45 +0100 Subject: [PATCH 2/3] FIX Admin bloacklisted messages using correct $.inArray check --- admin/javascript/LeftAndMain.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin/javascript/LeftAndMain.js b/admin/javascript/LeftAndMain.js index 577cd9c33..1dd8ceb25 100644 --- a/admin/javascript/LeftAndMain.js +++ b/admin/javascript/LeftAndMain.js @@ -150,7 +150,7 @@ jQuery.noConflict(); } // Show message (but ignore aborted requests) - if(xhr.status !== 0 && msg && $.inArray(msg, ignoredMessages)) { + if(xhr.status !== 0 && msg && $.inArray(msg, ignoredMessages) != -1) { // Decode into UTF-8, HTTP headers don't allow multibyte statusMessage(decodeURIComponent(msg), msgType); } From a38eb8b784406f8558f79bd4d99118467513b1a6 Mon Sep 17 00:00:00 2001 From: Damian Mooyman Date: Mon, 2 May 2016 18:15:39 +1200 Subject: [PATCH 3/3] Fix incorrect logic check --- admin/javascript/LeftAndMain.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/admin/javascript/LeftAndMain.js b/admin/javascript/LeftAndMain.js index 1dd8ceb25..6295e69ae 100644 --- a/admin/javascript/LeftAndMain.js +++ b/admin/javascript/LeftAndMain.js @@ -150,7 +150,7 @@ jQuery.noConflict(); } // Show message (but ignore aborted requests) - if(xhr.status !== 0 && msg && $.inArray(msg, ignoredMessages) != -1) { + if(xhr.status !== 0 && msg && $.inArray(msg, ignoredMessages) === -1) { // Decode into UTF-8, HTTP headers don't allow multibyte statusMessage(decodeURIComponent(msg), msgType); } @@ -816,9 +816,9 @@ jQuery.noConflict(); sessionStates = sessionData ? JSON.parse(sessionData) : false; this.find('.cms-tabset, .ss-tabset').each(function() { - var index, - tabset = $(this), - tabsetId = tabset.attr('id'), + var index, + tabset = $(this), + tabsetId = tabset.attr('id'), tab, forcedTab = tabset.children('ul').children('li.ss-tabs-force-active');