[Rt-commit] rt branch, 4.0/multipart-mail-fail, updated. rt-4.0.0rc6-129-g277ee93
Kevin Falcone
falcone at bestpractical.com
Fri Mar 18 13:18:03 EDT 2011
The branch, 4.0/multipart-mail-fail has been updated
via 277ee9327234434d1cefae5d182ed1ac99c07604 (commit)
from 65b1054888a8e93057fab8fcb245366eefd314b4 (commit)
Summary of changes:
lib/RT/Action/SendEmail.pm | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
- Log -----------------------------------------------------------------
commit 277ee9327234434d1cefae5d182ed1ac99c07604
Author: Kevin Falcone <falcone at bestpractical.com>
Date: Fri Mar 18 13:14:12 2011 -0400
Previously, we killed the RowsPerPage() call to avoid harming the cache
Rather than trading performance to avoid the landmine of the
Transaction->Attachments cache, we'll just built our own single element
attachment collection.
Calling RowsPerPage on the value returned from Transaction->Attachments
means that any future code that calls Attachments on this Transaction
object will only ever return a single attachment. This fails
predictably when Transaction->ContentObj wants to iterate through all
your attachments but only gets 1.
diff --git a/lib/RT/Action/SendEmail.pm b/lib/RT/Action/SendEmail.pm
index a98fea6..032c195 100644
--- a/lib/RT/Action/SendEmail.pm
+++ b/lib/RT/Action/SendEmail.pm
@@ -949,7 +949,14 @@ sub SetSubject {
return ();
}
- my $message = $self->TransactionObj->Attachments;
+ # don't use Transaction->Attachments because it caches
+ # and anything which later calls ->Attachments will be hurt
+ # by our RowsPerPage() call. caching is hard.
+ my $message = RT::Attachments->new( $self->CurrentUser );
+ $message->Limit( FIELD => 'TransactionId', VALUE => $self->TransactionObj->id);
+ $message->OrderBy( FIELD => 'id', ORDER => 'ASC' );
+ $message->RowsPerPage(1);
+
if ( $self->{'Subject'} ) {
$subject = $self->{'Subject'};
} elsif ( my $first = $message->First ) {
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list