[Rt-commit] [rtir] 01/01: Restore removed simple search by id.

Kevin Falcone falcone at bestpractical.com
Tue Jul 23 14:31:51 EDT 2013


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

falcone pushed a commit to branch 3.0/simple-search-ticket-redirect
in repository rtir.

commit 2a38e0f367cf519350938eddb3425cf2e200606a
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Tue Jul 23 13:14:53 2013 -0400

    Restore removed simple search by id.
    
    When 7131a78 changed RTIR over to the new Googleish search API, it lost
    an important feature.  You could no longer type 7 into the RTIR Simple
    Search and jump to 7.  You would be forced into a search for an Incident
    with the id of 7, and presented with a results list of 1 (if this was an
    incident).  If you were trying to jump to anything but an Incident, you
    got an empty search result.
    
    This updates the tests that were written for new features with tests
    that ensure this feature works.
    
    Copied core's convention of accepting #1 and 1 so that copy/paste from
    email subjects is less confusing.
    
    The confusing Incident search behavior of a list of 1 item also revealed
    that RTIR's Search Results do not support core's
    $SearchResultsAutoRedirect configuration option.
---
 html/RTIR/index.html | 5 +++++
 t/searches/simple.t  | 8 +++++++-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/html/RTIR/index.html b/html/RTIR/index.html
index 3ad2b2c..8933d05 100644
--- a/html/RTIR/index.html
+++ b/html/RTIR/index.html
@@ -61,6 +61,11 @@ unless ( exists $session{'my_rtir_portlets'} ) {
 my $portlets = $session{'my_rtir_portlets'};
 
 if ( defined $q && length $q ) {
+
+    if ($q =~ /^#?(\d+)$/) {
+        RT::Interface::Web::Redirect(RT->Config->Get('WebURL')."RTIR/Display.html?id=".$1);
+    }
+
     my $query = RT::IR->ParseSimpleSearch(
         Query => $q,
         CurrentUser => $session{'CurrentUser'},
diff --git a/t/searches/simple.t b/t/searches/simple.t
index 0a8c4c7..69840b6 100644
--- a/t/searches/simple.t
+++ b/t/searches/simple.t
@@ -3,7 +3,7 @@
 use strict;
 use warnings;
 
-use RT::IR::Test tests => 20;
+use RT::IR::Test tests => 24;
 
 RT::Test->started_ok;
 my $agent = default_agent();
@@ -24,4 +24,10 @@ my $agent = default_agent();
 
     $agent->get_ok( '/RTIR/index.html?q=192.168.1.1' );
     $agent->content_like(qr{test ir});
+
+    $agent->get_ok( "/RTIR/index.html?q=$inc_id" );
+    is($agent->uri,$agent->rt_base_url."RTIR/Display.html?id=$inc_id","Directed to the Incident Page");
+
+    $agent->get_ok( "/RTIR/index.html?q=$ir_id" );
+    is($agent->uri,$agent->rt_base_url."RTIR/Display.html?id=$ir_id","Directed to the Report Page");
 }

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


More information about the Rt-commit mailing list