From 5e7a4c7fb51294a073d946974855401e86da33e1 Mon Sep 17 00:00:00 2001 From: Dan Brown Date: Sat, 5 Mar 2016 22:54:53 +0000 Subject: [PATCH] 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. --- app/Http/Controllers/HomeController.php | 1 - resources/views/home.blade.php | 8 ++++++-- tests/EntityTest.php | 18 ++++++++++++++++++ 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index e20c89e06..489396df6 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -24,7 +24,6 @@ class HomeController extends Controller /** * Display the homepage. - * * @return Response */ public function index() diff --git a/resources/views/home.blade.php b/resources/views/home.blade.php index 8aaae1e1b..f840be965 100644 --- a/resources/views/home.blade.php +++ b/resources/views/home.blade.php @@ -33,10 +33,14 @@

Recently Created Pages

- @include('partials/entity-list', ['entities' => $recentlyCreatedPages, 'style' => 'compact']) +
+ @include('partials/entity-list', ['entities' => $recentlyCreatedPages, 'style' => 'compact']) +

Recently Updated Pages

- @include('partials/entity-list', ['entities' => $recentlyCreatedPages, 'style' => 'compact']) +
+ @include('partials/entity-list', ['entities' => $recentlyUpdatedPages, 'style' => 'compact']) +
diff --git a/tests/EntityTest.php b/tests/EntityTest.php index 2936fc047..30858f8d9 100644 --- a/tests/EntityTest.php +++ b/tests/EntityTest.php @@ -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); + } + }