From 63b0059ed55dceaa58396b7baeb2b490b57ce9cc Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Mon, 31 Aug 2020 13:58:09 +0200 Subject: [PATCH] Fix broken route to filter not tagged bookmarks Also display the filter for visitors. Fixes #1529 --- application/security/SessionManager.php | 1 - index.php | 2 +- tests/security/SessionManagerTest.php | 13 ++++---- tpl/default/linklist.paging.html | 44 +++++++++++++------------ 4 files changed, 31 insertions(+), 29 deletions(-) diff --git a/application/security/SessionManager.php b/application/security/SessionManager.php index 76b0afe8..36df8c1c 100644 --- a/application/security/SessionManager.php +++ b/application/security/SessionManager.php @@ -183,7 +183,6 @@ class SessionManager unset($this->session['expires_on']); unset($this->session['username']); unset($this->session['visibility']); - unset($this->session['untaggedonly']); } } diff --git a/index.php b/index.php index e7471823..869f42de 100644 --- a/index.php +++ b/index.php @@ -95,7 +95,7 @@ $app->group('', function () { $this->get('/add-tag/{newTag}', '\Shaarli\Front\Controller\Visitor\TagController:addTag'); $this->get('/remove-tag/{tag}', '\Shaarli\Front\Controller\Visitor\TagController:removeTag'); $this->get('/links-per-page', '\Shaarli\Front\Controller\Visitor\PublicSessionFilterController:linksPerPage'); - $this->get('/untagged-only', '\Shaarli\Front\Controller\Admin\PublicSessionFilterController:untaggedOnly'); + $this->get('/untagged-only', '\Shaarli\Front\Controller\Visitor\PublicSessionFilterController:untaggedOnly'); })->add('\Shaarli\Front\ShaarliMiddleware'); $app->group('/admin', function () { diff --git a/tests/security/SessionManagerTest.php b/tests/security/SessionManagerTest.php index 60695dcf..11a59f9c 100644 --- a/tests/security/SessionManagerTest.php +++ b/tests/security/SessionManagerTest.php @@ -207,15 +207,16 @@ class SessionManagerTest extends TestCase 'expires_on' => time() + 1000, 'username' => 'johndoe', 'visibility' => 'public', - 'untaggedonly' => false, + 'untaggedonly' => true, ]; $this->sessionManager->logout(); - $this->assertFalse(isset($this->session['ip'])); - $this->assertFalse(isset($this->session['expires_on'])); - $this->assertFalse(isset($this->session['username'])); - $this->assertFalse(isset($this->session['visibility'])); - $this->assertFalse(isset($this->session['untaggedonly'])); + $this->assertArrayNotHasKey('ip', $this->session); + $this->assertArrayNotHasKey('expires_on', $this->session); + $this->assertArrayNotHasKey('username', $this->session); + $this->assertArrayNotHasKey('visibility', $this->session); + $this->assertArrayHasKey('untaggedonly', $this->session); + $this->assertTrue($this->session['untaggedonly']); } /** diff --git a/tpl/default/linklist.paging.html b/tpl/default/linklist.paging.html index 7b320eaf..20853330 100644 --- a/tpl/default/linklist.paging.html +++ b/tpl/default/linklist.paging.html @@ -1,27 +1,29 @@