]> BookStack Code Mirror - bookstack/commitdiff
Fixed incorrect recents pages on homescreen
authorDan Brown <redacted>
Sat, 5 Mar 2016 22:54:53 +0000 (22:54 +0000)
committerDan Brown <redacted>
Sat, 5 Mar 2016 22:54:53 +0000 (22:54 +0000)
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
resources/views/home.blade.php
tests/EntityTest.php

index e20c89e06339c41ab3c472d31c24ec38300f13df..489396df64d9f5cacac81f84fbb07bb398a6e537 100644 (file)
@@ -24,7 +24,6 @@ class HomeController extends Controller
 
     /**
      * Display the homepage.
-     *
      * @return Response
      */
     public function index()
index 8aaae1e1bd4c118bf385ab23219ef69e7b31ecd7..f840be965f70070731558dcc67bb1e0d8be04f0a 100644 (file)
 
             <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">
index 2936fc0475abe698fdbe420a6f1ece8718dadae0..30858f8d986f6fcb45c5203da666c788beb13485 100644 (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);
+    }
+
 }