Merge pull request #1072 from madmatt/pulls/changed-pages

Fix changed pages filter to match SiteTree's 'MODIFIED' label
This commit is contained in:
Damian Mooyman 2014-08-07 17:10:59 +12:00
commit 0884151f6a
2 changed files with 12 additions and 1 deletions

View File

@ -300,7 +300,7 @@ class CMSSiteTreeFilter_ChangedPages extends CMSSiteTreeFilter {
$pages = Versioned::get_by_stage('SiteTree', 'Stage'); $pages = Versioned::get_by_stage('SiteTree', 'Stage');
$pages = $this->applyDefaultFilters($pages) $pages = $this->applyDefaultFilters($pages)
->leftJoin('SiteTree_Live', '"SiteTree_Live"."ID" = "SiteTree"."ID"') ->leftJoin('SiteTree_Live', '"SiteTree_Live"."ID" = "SiteTree"."ID"')
->where('"SiteTree"."Version" > "SiteTree_Live"."Version"'); ->where('"SiteTree"."Version" <> "SiteTree_Live"."Version"');
return $pages; return $pages;
} }
} }

View File

@ -72,6 +72,17 @@ class CMSSiteTreeFilterTest extends SapphireTest {
$f = new CMSSiteTreeFilter_ChangedPages(array('Term' => 'No Matches')); $f = new CMSSiteTreeFilter_ChangedPages(array('Term' => 'No Matches'));
$results = $f->pagesIncluded(); $results = $f->pagesIncluded();
$this->assertEquals(0, count($results)); $this->assertEquals(0, count($results));
// If we roll back to an earlier version than what's on the published site, we should still show the changed
$changedPage->Title = 'Changed 2';
$changedPage->publish('Stage', 'Live');
$changedPage->doRollbackTo(1);
$f = new CMSSiteTreeFilter_ChangedPages(array('Term' => 'Changed'));
$results = $f->pagesIncluded();
$this->assertEquals(1, count($results));
$this->assertEquals(array('ID' => $changedPage->ID, 'ParentID' => 0), $results[0]);
} }
public function testDeletedPagesFilter() { public function testDeletedPagesFilter() {