[Rt-commit] rt branch, 3.8/multipart-mail-fail, updated. rt-3.8.9-43-g81cb90b
Kevin Falcone
falcone at bestpractical.com
Fri Mar 18 13:55:19 EDT 2011
The branch, 3.8/multipart-mail-fail has been updated
via 81cb90b2c987a6d5b04a83bbcd51a9180eeed071 (commit)
from efe68af7073d8c3c4e2684a8700e02d86dd7a957 (commit)
Summary of changes:
lib/RT/Action/SendEmail.pm | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
- Log -----------------------------------------------------------------
commit 81cb90b2c987a6d5b04a83bbcd51a9180eeed071
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.
(cherry picked from commit 277ee9327234434d1cefae5d182ed1ac99c07604)
diff --git a/lib/RT/Action/SendEmail.pm b/lib/RT/Action/SendEmail.pm
index 7fd4eab..9e93e4a 100755
--- a/lib/RT/Action/SendEmail.pm
+++ b/lib/RT/Action/SendEmail.pm
@@ -931,7 +931,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