[Rt-commit] rt branch, 4.0/use-query-param-in-charts-subnav, created. rt-4.0.14rc1-26-gc1db686

Jim Brandt jbrandt at bestpractical.com
Fri Jul 19 14:15:07 EDT 2013


The branch, 4.0/use-query-param-in-charts-subnav has been created
        at  c1db686026b0861ce76f1b74aa5107c467aaf282 (commit)

- Log -----------------------------------------------------------------
commit f92e756e2b85e11c561b9643b9d31a333e78916c
Author: Jim Brandt <jbrandt at bestpractical.com>
Date:   Fri Jul 19 13:45:12 2013 -0400

    Test showing incorrect subnav links in Charts.html
    
    Charts.html uses a saved search from the session to create links
    even if a Query is passed in. It should use the Query when
    provided.

diff --git a/t/web/charting.t b/t/web/charting.t
index 32d95d9..e19ec41 100644
--- a/t/web/charting.t
+++ b/t/web/charting.t
@@ -76,3 +76,20 @@ $m->content_like(qr{<img src="/Search/Chart\?}, "Found image");
 $m->get_ok( "/Search/Chart?Query=id>0&PrimaryGroupBy=Requestor.Phone" );
 is( $m->content_type, "image/png" );
 ok( length($m->content), "Has content" );
+
+diag "Confirm subnav links use Query param before saved search in session.";
+
+$m->get_ok( "/Search/Chart.html?Query=id>0" );
+my $advanced = $m->find_link( text => 'Advanced' )->URI->equery;
+like( $advanced, qr{Query=id%3E0},
+      'Advanced link has Query param with id search'
+    );
+
+# Load the session with another search.
+$m->get_ok( "/Search/Results.html?Query=Queue='General'" );
+
+$m->get_ok( "/Search/Chart.html?Query=id>0" );
+$advanced = $m->find_link( text => 'Advanced' )->URI->equery;
+like( $advanced, qr{Query=id%3E0},
+      'Advanced link still has Query param with id search'
+    );

commit c1db686026b0861ce76f1b74aa5107c467aaf282
Author: Jim Brandt <jbrandt at bestpractical.com>
Date:   Fri Jul 19 13:47:49 2013 -0400

    Use Query when passed to create subnav links on Charts.html
    
    Charts.html was using the search saved in the session even
    when a Query was passed in. This caused incorrect links when
    using multiple tabs, looking at search results in one tab, then
    looking at a chart in another tab. The session search from the
    other tab would be used when creating the Edit Search, Advanced,
    etc. links.

diff --git a/share/html/Search/Chart.html b/share/html/Search/Chart.html
index 6e86d4b..57377b1 100644
--- a/share/html/Search/Chart.html
+++ b/share/html/Search/Chart.html
@@ -97,8 +97,8 @@ my %query;
     );
 
     for(@session_fields) {
-        $query{$_} = $current->{$_} unless defined $query{$_};
         $query{$_} = $DECODED_ARGS->{$_} unless defined $query{$_};
+        $query{$_} = $current->{$_} unless defined $query{$_};
     }
 
     if ($DECODED_ARGS->{'SavedSearchLoadSubmit'}) {

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


More information about the Rt-commit mailing list