[Rt-commit] rt branch, 4.2/concise-ticket-link-descriptions, created. rt-4.1.8-153-g7495eaf

Thomas Sibley trs at bestpractical.com
Thu Apr 18 21:15:04 EDT 2013


The branch, 4.2/concise-ticket-link-descriptions has been created
        at  7495eafa30af9ecd746451342c71ccb823eafecf (commit)

- Log -----------------------------------------------------------------
commit 7495eafa30af9ecd746451342c71ccb823eafecf
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Thu Apr 18 17:17:48 2013 -0700

    Stringify ticket links as "#123: Subject"
    
    Removes the leading "Ticket" from the description to save space and
    avoid repetition.  Unqualified numeric IDs are presented as and assumed
    to be ticket IDs in many places and user input throughout RT's various
    interfaces.  Links to other object types are still qualified, such as
    "Article #123: Name".

diff --git a/lib/RT/URI/fsck_com_rt.pm b/lib/RT/URI/fsck_com_rt.pm
index c1df39f..7daec8b 100644
--- a/lib/RT/URI/fsck_com_rt.pm
+++ b/lib/RT/URI/fsck_com_rt.pm
@@ -209,27 +209,25 @@ sub HREF {
 
 =head2 AsString
 
-Returns either a localized string 'ticket #23' or the full URI if the object is not local
+Returns either a localized string C<#23: Subject> for tickets, C<ObjectType #13:
+Name> for other object types (not really used), or the full URI if the object
+is not local.
 
 =cut
 
 sub AsString {
     my $self = shift;
     if ($self->IsLocal && ( my $object = $self->Object )) {
-        my $name = "";
         if ($object->isa('RT::Ticket')) {
-            $name = $object->Subject||'';
-        } elsif ( $object->_Accessible('Name', 'read') ) {
-            $name = $object->Name||'';
-        }
-
-        # awful historical baggage, we rely on the lowercase ticket in a number of places
-        my $object_type = ($self->ObjectType eq 'ticket' ? 'Ticket' : $self->ObjectType);
-
-        if ( $name ) {
-            return $self->loc("[_1] #[_2]: [_3]", $object_type, $object->Id, $name);
+            return $self->loc("#[_1]: [_2]", $object->Id, $object->Subject || '');
         } else {
-            return $self->loc("[_1] #[_2]", $object_type, $object->Id);
+            my $name = $object->_Accessible('Name', 'read') ? $object->Name : undef;
+
+            if ( defined $name and length $name ) {
+                return $self->loc("[_1] #[_2]: [_3]", $self->ObjectType, $object->Id, $name);
+            } else {
+                return $self->loc("[_1] #[_2]", $self->ObjectType, $object->Id);
+            }
         }
     }
     else {
diff --git a/t/web/command_line.t b/t/web/command_line.t
index 4ffe311..4572395 100644
--- a/t/web/command_line.t
+++ b/t/web/command_line.t
@@ -401,9 +401,9 @@ expect_send("merge $merge_ticket_B $merge_ticket_A", 'Merging the tickets...');
 expect_like(qr/Merge completed/, 'Merged the tickets');
 
 expect_send("show ticket/$merge_ticket_A/history", 'Checking merge on first ticket');
-expect_like(qr/Merged into Ticket #$merge_ticket_A: CLIMergeTest1-$$ by root/, 'Merge recorded in first ticket');
+expect_like(qr/Merged into #$merge_ticket_A: CLIMergeTest1-$$ by root/, 'Merge recorded in first ticket');
 expect_send("show ticket/$merge_ticket_B/history", 'Checking merge on second ticket');
-expect_like(qr/Merged into Ticket #$merge_ticket_A: CLIMergeTest1-$$ by root/, 'Merge recorded in second ticket');
+expect_like(qr/Merged into #$merge_ticket_A: CLIMergeTest1-$$ by root/, 'Merge recorded in second ticket');
 
 {
     # create a user; give them privileges to take and steal

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


More information about the Rt-commit mailing list