Commit 2a38e0f3 authored by Kevin Falcone's avatar Kevin Falcone
Browse files

Restore removed simple search by id.

When 7131a78b 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.
parent 6e91c4ed
......@@ -61,6 +61,11 @@ unless ( exists $session{'my_rtir_portlets'} ) {
my $portlets = $session{'my_rtir_portlets'};
if ( defined $q && length $q ) {
if ($q =~ /^#?(\d+)$/) {
my $query = RT::IR->ParseSimpleSearch(
Query => $q,
CurrentUser => $session{'CurrentUser'},
......@@ -3,7 +3,7 @@
use strict;
use warnings;
use RT::IR::Test tests => 20;
use RT::IR::Test tests => 24;
my $agent = default_agent();
......@@ -24,4 +24,10 @@ my $agent = default_agent();
$agent->get_ok( '/RTIR/index.html?q=' );
$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");
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment