- unless ( $self->{"$field$type"} ) {
- $self->{"$field$type"} = new RT::Links( $self->CurrentUser );
- if ( $self->CurrentUserHasRight('ShowTicket') ) {
- # Maybe this ticket is a merged ticket
- my $Tickets = new RT::Tickets( $self->CurrentUser );
- # at least to myself
- $self->{"$field$type"}->Limit( FIELD => $field,
- VALUE => $self->URI,
- ENTRYAGGREGATOR => 'OR' );
- $Tickets->Limit( FIELD => 'EffectiveId',
- VALUE => $self->EffectiveId );
- while (my $Ticket = $Tickets->Next) {
- $self->{"$field$type"}->Limit( FIELD => $field,
- VALUE => $Ticket->URI,
- ENTRYAGGREGATOR => 'OR' );
- }
- $self->{"$field$type"}->Limit( FIELD => 'Type',
- VALUE => $type )
- if ($type);
- }
+ my $cache_key = "$field$type";
+ return $self->{ $cache_key } if $self->{ $cache_key };
+
+ my $links = $self->{ $cache_key }
+ = RT::Links->new( $self->CurrentUser );
+ unless ( $self->CurrentUserHasRight('ShowTicket') ) {
+ $links->Limit( FIELD => 'id', VALUE => 0 );
+ return $links;