From b8d19ba4951829457b23fc4d163db66bee760a18 Mon Sep 17 00:00:00 2001 From: Damian Mooyman Date: Fri, 30 May 2014 14:44:35 +1200 Subject: [PATCH] BUG Fix deleted pages redirecting the CMS Update behat tests for Mink 1.6 compatibility --- code/controllers/ContentController.php | 6 ------ code/model/SiteTree.php | 6 +++++- tests/behat/features/insert-a-link.feature | 3 +-- tests/behat/features/manage-files.feature | 2 +- tests/behat/features/manage-page-permissions.feature | 4 ++-- tests/behat/features/publish-a-page.feature | 4 ++-- 6 files changed, 11 insertions(+), 14 deletions(-) diff --git a/code/controllers/ContentController.php b/code/controllers/ContentController.php index b1458109..ce0bb148 100644 --- a/code/controllers/ContentController.php +++ b/code/controllers/ContentController.php @@ -120,12 +120,6 @@ class ContentController extends Controller { ) ) { if(!$this->dataRecord->canViewStage(Versioned::current_archived_date() ? 'Stage' : Versioned::current_stage())) { - $link = $this->Link(); - $message = _t( - "ContentController.DRAFT_SITE_ACCESS_RESTRICTION", - 'You must log in with your CMS password in order to view the draft or archived content. ' . - 'Click here to go back to the published site.' - ); Session::clear('currentStage'); Session::clear('archiveDate'); diff --git a/code/model/SiteTree.php b/code/model/SiteTree.php index 47cf8bae..c61194c4 100644 --- a/code/model/SiteTree.php +++ b/code/model/SiteTree.php @@ -1397,7 +1397,11 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid $tags .= $this->ExtraMeta . "\n"; } - if(Permission::check('CMS_ACCESS_CMSMain') && in_array('CMSPreviewable', class_implements($this)) && !$this instanceof ErrorPage) { + if(Permission::check('CMS_ACCESS_CMSMain') + && in_array('CMSPreviewable', class_implements($this)) + && !$this instanceof ErrorPage + && $this->ID > 0 + ) { $tags .= "ID}\" />\n"; $tags .= "CMSEditLink() . "\" />\n"; } diff --git a/tests/behat/features/insert-a-link.feature b/tests/behat/features/insert-a-link.feature index c64ee80e..be57ac3c 100644 --- a/tests/behat/features/insert-a-link.feature +++ b/tests/behat/features/insert-a-link.feature @@ -50,8 +50,7 @@ So that I can link to a external website or a page on my site And I select "awesome" in the "Content" HTML field When I press the "Insert Link" button When I select the "Anchor on this page" radio button - # Need to hard-code the id attribute of the