Cleanup from dev.

This commit is contained in:
Harlan Lieberman-Berg 2015-12-21 16:17:31 -05:00
parent e1d580141b
commit 4ff8e0133c

View file

@ -7,7 +7,7 @@ use RT::Interface::Email ();
=head1 NAME =head1 NAME
RT::Interface::Email::TryThreading - Use In-Reply-To and other headers to try and find a ticket RT::Interface::Email::TryThreading - Use References and other headers to try and find a ticket
=cut =cut
@ -25,9 +25,9 @@ sub GetCurrentUser {
@_ @_
); );
if ($args{'Ticket'}) { if ($args{'Ticket'}->id) {
$RT::Logger->debug("Ticket %s already assigned. You don't need my help!", $RT::Logger->debug("Ticket %s already assigned. You don't need my help!",
$args{'Ticket'}); $args{'Ticket'}->id);
return ($args{'CurrentUser'}, $args{'AuthLevel'}); return ($args{'CurrentUser'}, $args{'AuthLevel'});
} }
@ -42,8 +42,8 @@ sub GetCurrentUser {
my %tickets = (); my %tickets = ();
foreach my $messageid (@messageids) { foreach my $messageid (@messageids) {
if (MessageIdToTicket($messageid)) { if (my $ids = MessageIdToTicket($messageid)) {
foreach my $ticket ($_) { foreach my $ticket ($ids) {
$tickets{$ticket} = undef; $tickets{$ticket} = undef;
} }
} }
@ -78,10 +78,10 @@ sub FetchPossibleHeaders {
# There may be multiple references # There may be multiple references
# In practice, In-Reply-To seems to no longer be worth parsing, as # In practice, In-Reply-To seems to no longer be worth parsing, as
# it seems to usually just be a repeat of the References. # it seems to usually just be a repeat of the References.
if ($head->get('References')) { if (my $refs = $head->get('References')) {
chomp(); chomp();
foreach my $ref (split(/\s+/, $_)) { foreach my $ref (split(/\s+/, $refs)) {
$ref =~ /,?<([^>]+)>/; $ref =~ /,?<([^>]+)>/;
if ($1) { if ($1) {
push(@msgids, $1); push(@msgids, $1);
@ -93,6 +93,7 @@ sub FetchPossibleHeaders {
} }
} }
} }
return @msgids;
} }
sub MessageIdToTicket { sub MessageIdToTicket {
@ -136,7 +137,7 @@ sub MessageIdToTicket {
); );
my %tickets; my %tickets;
while (my $attach => $attachments->Next) { while (my $attach = $attachments->Next) {
$tickets{$attach->TransactionObj()->Ticket} = undef; $tickets{$attach->TransactionObj()->Ticket} = undef;
} }