Fix changed pages filter to match SiteTree's 'MODIFIED' label

This commit is contained in:
madmatt 2014-08-07 15:49:09 +12:00
parent 3a5c5efc7c
commit 4e5b1966d3
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 = $this->applyDefaultFilters($pages)
->leftJoin('SiteTree_Live', '"SiteTree_Live"."ID" = "SiteTree"."ID"')
->where('"SiteTree"."Version" > "SiteTree_Live"."Version"');
->where('"SiteTree"."Version" <> "SiteTree_Live"."Version"');
return $pages;
}
}

View File

@ -72,6 +72,17 @@ class CMSSiteTreeFilterTest extends SapphireTest {
$f = new CMSSiteTreeFilter_ChangedPages(array('Term' => 'No Matches'));
$results = $f->pagesIncluded();
$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() {