[Rt-commit] rt branch, 4.0/search-display-of-local-links, created. rt-4.0.13-53-g1e3315a

Thomas Sibley trs at bestpractical.com
Mon Jun 17 19:37:44 EDT 2013


The branch, 4.0/search-display-of-local-links has been created
        at  1e3315a0d100665aef5cfe008d78499c324e0891 (commit)

- Log -----------------------------------------------------------------
commit 1e3315a0d100665aef5cfe008d78499c324e0891
Author: Bradley Bell <bradleyb at uw.edu>
Date:   Fri May 31 17:40:04 2013 -0700

    Show friendly string instead of "0" for non-ticket "local" links in search results

diff --git a/share/html/Elements/RT__Ticket/ColumnMap b/share/html/Elements/RT__Ticket/ColumnMap
index 06637ee..8b68b61 100644
--- a/share/html/Elements/RT__Ticket/ColumnMap
+++ b/share/html/Elements/RT__Ticket/ColumnMap
@@ -68,7 +68,7 @@ my $LinkCallback = sub {
             \'<a href="',
             $_->$mode_uri->Resolver->HREF,
             \'">',
-            ( $_->$mode_uri->IsLocal ? $_->$local_type : $_->$mode ),
+            ( $_->$mode_uri->IsLocal && $_->$local_type ? $_->$local_type : $_->$mode_uri->Resolver->AsString ),
             \'</a><br />',
         } @{ $_[0]->Links($other_mode,$type)->ItemsArrayRef }
     }
diff --git a/t/web/search_linkdisplay.t b/t/web/search_linkdisplay.t
new file mode 100644
index 0000000..e55aa90
--- /dev/null
+++ b/t/web/search_linkdisplay.t
@@ -0,0 +1,60 @@
+use strict;
+use warnings;
+
+use RT::Test tests => 14;
+my ( $baseurl, $m ) = RT::Test->started_ok;
+
+my $ticket = RT::Test->create_ticket(
+    Queue   => 'General',
+    Subject => 'ticket foo',
+);
+
+my $generic_url = 'http://generic_url.example.com';
+my $link = RT::Link->new( RT->SystemUser );
+my ($id,$msg) = $link->Create( Base => $ticket->URI, Target => $generic_url, Type => 'RefersTo' );
+ok($id, $msg);
+
+
+my $ticket2 = RT::Test->create_ticket(
+    Queue   => 'General',
+    Subject => 'ticket bar',
+);
+
+$link = RT::Link->new( RT->SystemUser );
+($id,$msg) = $link->Create( Base => $ticket->URI, Target => $ticket2->URI, Type => 'RefersTo' );
+ok($id, $msg);
+
+
+
+my $class = RT::Class->new( RT->SystemUser );
+($id, $msg) = $class->Create( Name => 'Test Class' );
+ok ($id, $msg);
+
+my $article = RT::Article->new( RT->SystemUser );
+($id, $msg) = $article->Create( Class => $class->Name, Summary => 'Test Article' );
+ok ($id, $msg);
+$article->Load($id);
+
+
+$link = RT::Link->new( RT->SystemUser );
+($id,$msg) = $link->Create( Base => $ticket->URI, Target => $article->URI, Type => 'RefersTo' );
+ok($id, $msg);
+
+
+ok( $m->login, 'logged in' );
+
+$m->get_ok("/Search/Results.html?Format=id,RefersTo;Query=id=".$ticket->Id);
+
+$m->title_is( 'Found 1 ticket', 'title' );
+
+my $ref = $m->find_link( url_regex => qr!generic_url! );
+ok( $ref, "found generic link" );
+is( $ref->text, $generic_url, $generic_url . " is displayed" );
+
+$ref = $m->find_link( url_regex => qr!/Ticket/Display.html! );
+ok( $ref, "found ticket link" );
+is( $ref->text, $ticket2->Id, $ticket2->Id . " is displayed" );
+
+$ref = $m->find_link( url_regex => qr!/Article/Display.html! );
+ok( $ref, "found article link" );
+is( $ref->text, $article->URIObj->Resolver->AsString, $article->URIObj->Resolver->AsString . " is displayed" );

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


More information about the Rt-commit mailing list