[Rt-commit] r7319 - in rt/branches/3.7-EXPERIMENTAL: .

ruz at bestpractical.com ruz at bestpractical.com
Thu Mar 22 21:37:26 EDT 2007


Author: ruz
Date: Thu Mar 22 21:37:26 2007
New Revision: 7319

Modified:
   rt/branches/3.7-EXPERIMENTAL/   (props changed)
   rt/branches/3.7-EXPERIMENTAL/lib/RT/Action/SendEmail.pm

Log:
 r4771 at cubic-pc:  cubic | 2007-03-21 15:58:09 +0300
 * use SQL instead of condition in loop


Modified: rt/branches/3.7-EXPERIMENTAL/lib/RT/Action/SendEmail.pm
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/lib/RT/Action/SendEmail.pm	(original)
+++ rt/branches/3.7-EXPERIMENTAL/lib/RT/Action/SendEmail.pm	Thu Mar 22 21:37:26 2007
@@ -295,7 +295,19 @@
     );
     $attachments->OrderBy( FIELD => 'id');
 
+    # We want to make sure that we don't include the attachment that's
+    # being sued as the "Content" of this message"
     my $transaction_content_obj = $self->TransactionObj->ContentObj;
+    if ( $transaction_content_obj && $transaction_content_obj->id
+         && $transaction_content_obj->ContentType =~ m{text/plain}i )
+    {
+        $attachments->Limit(
+            ENTRYAGGREGATOR => 'AND',
+            FIELD           => 'id',
+            OPERATOR        => '!=',
+            VALUE           => $transaction_content_obj->id,
+        );
+    }
 
     # attach any of this transaction's attachments
     while ( my $attach = $attachments->Next ) {
@@ -303,11 +315,6 @@
         # Don't attach anything blank
         next unless ( $attach->ContentLength );
 
-# We want to make sure that we don't include the attachment that's being sued as the "Content" of this message"
-        next
-          if ( $transaction_content_obj
-            && $transaction_content_obj->Id == $attach->Id
-            && $transaction_content_obj->ContentType =~ qr{text/plain}i );
         $MIMEObj->make_multipart('mixed');
         $MIMEObj->attach(
             Type     => $attach->ContentType,


More information about the Rt-commit mailing list