Skip to content

Commit

Permalink
Display RT-Attach headers in history by linking the filename
Browse files Browse the repository at this point in the history
It is possible recipients of the transaction saw the attachment via
email but can't see it via the web.  This should be improved in the
future, but it's an acceptable edge case at the moment since we avoid
storing the attachment twice.
  • Loading branch information
tsibley committed Aug 11, 2011
1 parent af0c0ad commit ea61a55
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 11 additions & 0 deletions share/html/Ticket/Elements/ShowMessageHeaders
Expand Up @@ -78,6 +78,17 @@ unless ( $display_headers{'_all'} ) {
my $ticket = $Message->TransactionObj->TicketObj;
foreach my $f (@headers) {
$m->comp('/Elements/MakeClicky', content => \$f->{'Value'}, ticket => $ticket, %ARGS);
if ($f->{'Tag'} eq 'RT-Attach') {
# Blat in the filename and linkify
my $att = RT::Attachment->new( $session{'CurrentUser'} );
$att->Load($f->{'Value'});
next unless $att->Id and $att->TransactionObj->CurrentUserCanSee;

$f->{'Value'} = sprintf '<a href="%s/Ticket/Attachment/%d/%d/%s">%s</a>',
RT->Config->Get('WebPath'), $att->TransactionObj->Id, $att->Id,
$m->interp->apply_escapes($att->Filename, qw(u h)),
$m->interp->apply_escapes($att->Filename, 'h');
}
}

if ( $Localize ) {
Expand Down
2 changes: 1 addition & 1 deletion share/html/Ticket/Elements/ShowTransactionAttachments
Expand Up @@ -118,7 +118,7 @@ if ( $Transaction->Type =~ /EmailRecord$/ ) {

# If the transaction has anything attached to it at all
elsif (!$ShowHeaders) {
@DisplayHeaders = qw(To From RT-Send-Cc Cc Bcc Date Subject);
@DisplayHeaders = qw(To From RT-Send-Cc Cc Bcc RT-Attach Date Subject);
push @DisplayHeaders, 'RT-Send-Bcc' if RT->Config->Get('ShowBccHeader');
}

Expand Down

0 comments on commit ea61a55

Please sign in to comment.