Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions resources/views/search/all.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -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")
<input type="hidden" name="filters[created_by]" value="{{ $options->filters['created_by'] }}">
@endif
@if(isset($options->filters['updated_by']))
@if(isset($options->filters['updated_by']) && $options->filters['updated_by'] !== "me")
<input type="hidden" name="filters[updated_by]" value="{{ $options->filters['updated_by'] }}">
@endif

Expand Down
13 changes: 10 additions & 3 deletions tests/Entity/EntitySearchTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -448,8 +448,15 @@ public function test_words_adjacent_to_lines_breaks_can_be_matched_with_normal_t

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"]');
}
}