mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
Merge pull request #1072 from madmatt/pulls/changed-pages
Fix changed pages filter to match SiteTree's 'MODIFIED' label
This commit is contained in:
commit
0884151f6a
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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() {
|
||||||
|
Loading…
Reference in New Issue
Block a user