diff options
author | Jason Crome <jcrome@bestpractical.com> | 2022-06-01 00:22:41 +0300 |
---|---|---|
committer | Jason Crome <jcrome@bestpractical.com> | 2022-06-01 00:22:41 +0300 |
commit | 907adb1a6edec02275a725b56a9fe20e042f7cb4 (patch) | |
tree | 5036b66ad832d6981c1d850ae2b43bd74b6e5689 | |
parent | feea28f1c0b2cd5db0fa5a2e499959ccbe02ec03 (diff) |
Make simple search result refresh always function5.0/simple-search-redirect-results
There is a circumstance in which simple search results cannot be
refreshed. Doing a simple search and selecting a refresh interval always
works, but the next simple search performed without changing the
refresh interval will produce the error "There was an error parsing your
search query..." This prevents that error from happening.
Simple search uses share/html/Search/Results.html to
display its results. When a refresh interval is selected, it is
submitted as a form parameter to /Search/Results.html, and a CSRF token
is generated for that request path. When the next simple search is
performed, the search term is submitted to /Search/Simple.html, and a
CSRF token is generated for that path. When the results auto-refresh,
however, the path /Search/Results.html is what is refreshed, and that
path doesn't match the path for the CSRF token, causing the error above.
There is nothing different about the simple search results page that
distinguishes it from the results provided by Search Builder, so rather
than compose that Mason template into Search/Simple.html, redirect to
Search/Results.html like Search Builder does currently.
-rw-r--r-- | share/html/Search/Simple.html | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/share/html/Search/Simple.html b/share/html/Search/Simple.html index b4823af339..edb4c3cae9 100644 --- a/share/html/Search/Simple.html +++ b/share/html/Search/Simple.html @@ -120,10 +120,10 @@ if ($q) { $m->callback( %ARGS, CallbackName => 'SearchArgs', args => \%args); - my $search = RT::Search::Simple->new(%args); - - $m->comp( "Results.html", Query => $search->QueryToSQL() ); - $m->comp( "/Elements/Footer" ); + my $search = RT::Search::Simple->new(%args); + my $query = $m->comp('/Elements/QueryString', Query => $search->QueryToSQL() ); + my $result_path = RT->Config->Get('WebURL') . "Search/Results.html?$query"; + RT::Interface::Web::Redirect( $result_path ); $m->abort(); } </%INIT> |