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

Thomas Sibley trs at bestpractical.com
Thu Apr 18 20:21:42 EDT 2013


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

- Log -----------------------------------------------------------------
commit a47d04618ef7822089ae1ce238bd349dfe342998
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 {

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


More information about the Rt-commit mailing list