[Rt-commit] r5712 - rt/branches/3.6-RELEASE/lib/RT/Action

ruz at bestpractical.com ruz at bestpractical.com
Mon Aug 7 22:52:43 EDT 2006


Author: ruz
Date: Mon Aug  7 22:52:43 2006
New Revision: 5712

Modified:
   rt/branches/3.6-RELEASE/lib/RT/Action/AutoOpen.pm

Log:
* get rid of uninit warnings
* refactor
* don't call $self->TransactionObj->Message->First twice

Modified: rt/branches/3.6-RELEASE/lib/RT/Action/AutoOpen.pm
==============================================================================
--- rt/branches/3.6-RELEASE/lib/RT/Action/AutoOpen.pm	(original)
+++ rt/branches/3.6-RELEASE/lib/RT/Action/AutoOpen.pm	Mon Aug  7 22:52:43 2006
@@ -71,18 +71,15 @@
     # if the ticket is already open or the ticket is new and the message is more mail from the
     # requestor, don't reopen it.
 
-    if ( ( $self->TicketObj->Status eq 'open' )
-         || ( ( $self->TicketObj->Status eq 'new' )
-              && $self->TransactionObj->IsInbound )
-         || ( defined $self->TransactionObj->Message->First
-              && $self->TransactionObj->Message->First->GetHeader('RT-Control') =~ /\bno-autoopen\b/i )
-      ) {
+    my $status = $self->TicketObj->Status;
+    return undef if $status eq 'open';
+    return undef if $status eq 'new' && $self->TransactionObj->IsInbound;
 
-        return undef;
-    }
-    else {
-        return (1);
+    if ( my $msg = $self->TransactionObj->Message->First ) {
+        return undef if ($msg->GetHeader('RT-Control') || '') =~ /\bno-autoopen\b/i;
     }
+
+    return 1;
 }
 # }}}
 


More information about the Rt-commit mailing list