From: Dan Brown Date: Sat, 15 Oct 2022 14:12:55 +0000 (+0100) Subject: Merge branch 'development' into bugfix/fix-being-unable-to-clear-filters X-Git-Tag: v22.10~1^2~11 X-Git-Url: http://source.bookstackapp.com/bookstack/commitdiff_plain/6adc642d2f19a998dea9bcc7b9d3f07f0c50cd6a?hp=22a91c955d8258c73dd5dbcf7f46cc302d31c4bd Merge branch 'development' into bugfix/fix-being-unable-to-clear-filters --- diff --git a/resources/views/search/all.blade.php b/resources/views/search/all.blade.php index 85e6d1b7b..96b14f6e5 100644 --- a/resources/views/search/all.blade.php +++ b/resources/views/search/all.blade.php @@ -61,10 +61,10 @@ @include('search.parts.date-filter', ['name' => 'created_after', 'filters' => $options->filters]) @include('search.parts.date-filter', ['name' => 'created_before', 'filters' => $options->filters]) - @if(isset($options->filters['created_by'])) + @if(isset($options->filters['created_by']) && $options->filters['created_by'] !== "me") @endif - @if(isset($options->filters['updated_by'])) + @if(isset($options->filters['updated_by']) && $options->filters['updated_by'] !== "me") @endif diff --git a/tests/Entity/EntitySearchTest.php b/tests/Entity/EntitySearchTest.php index 51fac48b2..c309f2167 100644 --- a/tests/Entity/EntitySearchTest.php +++ b/tests/Entity/EntitySearchTest.php @@ -446,8 +446,15 @@ class EntitySearchTest extends TestCase public function test_searches_with_user_filters_adds_them_into_advanced_search_form() { - $resp = $this->asEditor()->get('/search?term=' . urlencode('test {updated_by:me} {created_by:dan}')); - $this->withHtml($resp)->assertElementExists('form input[type="hidden"][name="filters[updated_by]"][value="me"]'); - $this->withHtml($resp)->assertElementExists('form input[type="hidden"][name="filters[created_by]"][value="dan"]'); + $resp = $this->asEditor()->get('/search?term=' . urlencode('test {updated_by:dan} {created_by:dan}')); + $this->withHtml($resp)->assertElementExists('form input[name="filters[updated_by]"][value="dan"]'); + $this->withHtml($resp)->assertElementExists('form input[name="filters[created_by]"][value="dan"]'); + } + + public function test_searches_with_user_filters_using_me_adds_them_into_advanced_search_form() + { + $resp = $this->asEditor()->get('/search?term=' . urlencode('test {updated_by:me} {created_by:me}')); + $this->withHtml($resp)->assertElementExists('form input[name="filters[updated_by]"][value="me"][checked="checked"]'); + $this->withHtml($resp)->assertElementExists('form input[name="filters[created_by]"][value="me"][checked="checked"]'); } }