- if ($self->IsLocal && $self->Object) {
- return $self->loc("[_1] #[_2]", $self->ObjectType, $self->Object->Id);
+ if ($self->IsLocal && ( my $object = $self->Object )) {
+ if ($object->isa('RT::Ticket')) {
+ return $self->loc("#[_1]: [_2]", $object->Id, $object->Subject || '');
+ } else {
+ 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);
+ }
+ }