Fixed incorrect recents pages on homescreen

Fixed the bug causing the recently updated pages to be exaclty the same as the recently create pages.
Also added in tests to prevent regression.
This commit is contained in:
Dan Brown 2016-03-05 22:54:53 +00:00
parent 76eaf64f94
commit 5e7a4c7fb5
3 changed files with 24 additions and 3 deletions

View File

@ -24,7 +24,6 @@ class HomeController extends Controller
/**
* Display the homepage.
*
* @return Response
*/
public function index()

View File

@ -33,10 +33,14 @@
<div class="col-sm-4">
<h3><a class="no-color" href="/pages/recently-created">Recently Created Pages</a></h3>
@include('partials/entity-list', ['entities' => $recentlyCreatedPages, 'style' => 'compact'])
<div id="recently-created-pages">
@include('partials/entity-list', ['entities' => $recentlyCreatedPages, 'style' => 'compact'])
</div>
<h3><a class="no-color" href="/pages/recently-updated">Recently Updated Pages</a></h3>
@include('partials/entity-list', ['entities' => $recentlyCreatedPages, 'style' => 'compact'])
<div id="recently-updated-pages">
@include('partials/entity-list', ['entities' => $recentlyUpdatedPages, 'style' => 'compact'])
</div>
</div>
<div class="col-sm-4" id="recent-activity">

View File

@ -225,4 +225,22 @@ class EntityTest extends TestCase
->seePageIs($newPageUrl);
}
public function test_recently_updated_pages_on_home()
{
$page = \BookStack\Page::orderBy('updated_at', 'asc')->first();
$this->asAdmin()->visit('/')
->dontSeeInElement('#recently-updated-pages', $page->name);
$this->visit($page->getUrl() . '/edit')
->press('Save Page')
->visit('/')
->seeInElement('#recently-updated-pages', $page->name);
}
public function test_recently_created_pages_on_home()
{
$entityChain = $this->createEntityChainBelongingToUser($this->getNewUser());
$this->asAdmin()->visit('/')
->seeInElement('#recently-created-pages', $entityChain['page']->name);
}
}