[Rt-commit] [rtir] 08/12: Stop using Mason Notes and just pass Arguments.

Kevin Falcone falcone at bestpractical.com
Fri Jul 12 10:40:03 EDT 2013


This is an automated email from the git hooks/post-receive script.

falcone pushed a commit to branch 2.9/edit-search-regressions
in repository rtir.

commit b69e4cd760fa0ba1abe68c1119e4fe88a70b3e38
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Thu Jul 11 18:24:16 2013 -0400

    Stop using Mason Notes and just pass Arguments.
    
    This makes RTIR more like core, which passes %TabArgs in a few places.
    
    This reveals a number of misconceptions in the Refine code.  It was
    relying on the ShowResults code to clobber $session{'tickets'}, which is
    a bug that was fixed in 8d3cc5fa0.
    
    This reliance on being able to grovel in your session meant that
    whatever search you ran last would show up when you clicked on Edit
    Search on a Merge (or other) Refine page.  So, if you were Merging
    something and went to visit your homepage, or looked at any other
    Incident, you'd see some completely irrelevant search.
    
    Instead, we're now *explicit* about the passed information.
    We still have to separate the Query and BaseQuery because RTIR's search
    is built around that distinction, but from now on, clicking Edit Search
    will edit the search that was run to generate the Merge page.  This
    includes passing the correct Format.
    
    This change, plus the previous change to make Add these terms and Search
    work means that you can now visit an Incident page, click Merge, click
    Edit search, search for a resolved Incident as well as one that's open,
    click back to see results and then merge into a resolved incident.
    
    We could no longer rely simply on $m->notes in one place because you
    must change the Tabs from each of the Entry pages (/Merge/index.html)
    and not *just* on Refine.html, which is much too late.  There will be
    several follow on commits to resolve the other places that relied on
    this erroneous code.
---
 html/Callbacks/RTIR/Elements/Tabs/Privileged | 5 +++--
 html/RTIR/Merge/index.html                   | 2 +-
 html/RTIR/Search/Elements/RefinePage         | 4 +---
 t/walk-web.t                                 | 2 +-
 4 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/html/Callbacks/RTIR/Elements/Tabs/Privileged b/html/Callbacks/RTIR/Elements/Tabs/Privileged
index 0abf23e..b160eb6 100644
--- a/html/Callbacks/RTIR/Elements/Tabs/Privileged
+++ b/html/Callbacks/RTIR/Elements/Tabs/Privileged
@@ -113,9 +113,10 @@ my $re_rtir_types = '(?:'. join( '|', map "\Q$_\E", RT::IR->Types ) .')';
 
 my $search_arguments = sub {
     my %res = ();
+    my $caller_args = $m->caller_args(1);
     my @query_fields = qw(Query Format RowsPerPage Page OrderBy Order);
-    if ( my $refined = $m->notes('RefinedSearch') ) {
-        @res{ @query_fields } = @{ $refined->{'query'} }{ @query_fields };
+    if ( $caller_args->{'RefineArgs'} ) {
+        @res{ @query_fields } = @{ $caller_args->{'RefineArgs'} }{ @query_fields };
     } else {
         @res{ @query_fields } = @{ $args }{ @query_fields };
     }
diff --git a/html/RTIR/Merge/index.html b/html/RTIR/Merge/index.html
index 54f7d05..f80c81f 100644
--- a/html/RTIR/Merge/index.html
+++ b/html/RTIR/Merge/index.html
@@ -46,7 +46,7 @@
 %#
 %# END BPS TAGGED BLOCK }}}
 <& /Elements/Header, Title => $title, Refresh => $session{'tickets_refresh_interval'} &>
-<& /Elements/Tabs &>
+<& /Elements/Tabs, RefineArgs => { %defaults, Query => $Query } &>
 
 % $m->callback(CallbackName => 'BeforeActionList', Actions => \@results, ARGSRef => \%ARGS, Ticket => $Ticket);
 
diff --git a/html/RTIR/Search/Elements/RefinePage b/html/RTIR/Search/Elements/RefinePage
index 9f2ad4a..640e057 100644
--- a/html/RTIR/Search/Elements/RefinePage
+++ b/html/RTIR/Search/Elements/RefinePage
@@ -46,7 +46,7 @@
 %#
 %# END BPS TAGGED BLOCK }}}
 <& /RTIR/Elements/Header, Title => $Title &>
-<& /Elements/Tabs &> 
+<& /Elements/Tabs, RefineArgs => $query_state{query}  &>
 <& BuildQuery,
     %query_state,
 
@@ -63,8 +63,6 @@ my %query_state = $m->comp('ProcessQuery',
     ResultPage => $ResultPage,
 );
 
-$m->notes( 'RefinedSearch' => \%query_state );
-
 my @results = @{ delete $query_state{'results'} };
 
 my $QueryString = $m->comp( '/Elements/QueryString', %{ $query_state{'query'} } );
diff --git a/t/walk-web.t b/t/walk-web.t
index 6d02dc3..fe9abe6 100644
--- a/t/walk-web.t
+++ b/t/walk-web.t
@@ -5,7 +5,7 @@ use warnings;
 
 use HTML::TreeBuilder;
 
-use RT::IR::Test tests => 528;
+use RT::IR::Test tests => 564;
 
 RT::Test->started_ok;
 my $m = default_agent();

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Rt-commit mailing list