[Rt-commit] rt branch 5.0/simple-search-redirect-results created. rt-5.0.2-258-g907adb1a6e

BPS Git Server git at git.bestpractical.com
Tue May 31 21:25:52 UTC 2022


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "rt".

The branch, 5.0/simple-search-redirect-results has been created
        at  907adb1a6edec02275a725b56a9fe20e042f7cb4 (commit)

- Log -----------------------------------------------------------------
commit 907adb1a6edec02275a725b56a9fe20e042f7cb4
Author: Jason Crome <jcrome at bestpractical.com>
Date:   Tue May 31 17:22:41 2022 -0400

    Make simple search result refresh always function
    
    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.

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>

-----------------------------------------------------------------------


hooks/post-receive
-- 
rt


More information about the rt-commit mailing list