[Rt-commit] r18446 - in rt/3.999/branches/lorzy: lib/RT
clkao at bestpractical.com
clkao at bestpractical.com
Wed Feb 18 10:24:36 EST 2009
Author: clkao
Date: Wed Feb 18 10:24:35 2009
New Revision: 18446
Modified:
rt/3.999/branches/lorzy/lib/RT/Rule.pm
rt/3.999/branches/lorzy/lib/RT/ScripAction.pm
rt/3.999/branches/lorzy/t/mail/sendmail.t
Log:
preserve hints when invoking scripaction from rules.
Modified: rt/3.999/branches/lorzy/lib/RT/Rule.pm
==============================================================================
--- rt/3.999/branches/lorzy/lib/RT/Rule.pm (original)
+++ rt/3.999/branches/lorzy/lib/RT/Rule.pm Wed Feb 18 10:24:35 2009
@@ -91,10 +91,12 @@
$template = $t;
}
- my $action = $ScripAction->load_action( transaction_obj => $self->transaction_obj,
- ticket_obj => $self->ticket_obj,
- %args,
- );
+ my $action = $ScripAction->load_action(
+ transaction_obj => $self->transaction_obj,
+ ticket_obj => $self->ticket_obj,
+ source_scripaction_name => $scrip_action,
+ %args,
+ );
# XXX: fix template to allow additional arguments to be passed from here
$action->{'template_obj'} = $template;
Modified: rt/3.999/branches/lorzy/lib/RT/ScripAction.pm
==============================================================================
--- rt/3.999/branches/lorzy/lib/RT/ScripAction.pm (original)
+++ rt/3.999/branches/lorzy/lib/RT/ScripAction.pm Wed Feb 18 10:24:35 2009
@@ -84,7 +84,7 @@
argument => undef,
current_user => undef,
scrip_action_obj => undef,
- scrip_obj => undef,
+ hints => {},
template_obj => undef,
ticket_obj => undef,
transaction_obj => undef,
@@ -96,14 +96,13 @@
$self->{'argument'} = $args{'argument'};
$self->current_user( $args{'current_user'} );
$self->{'scrip_action_obj'} = $args{'scrip_action_obj'};
- $self->{'scrip_obj'} = $args{'scrip_obj'};
$self->{'template_obj'} = $args{'template_obj'};
$self->{'ticket_obj'} = $args{'ticket_obj'};
$self->{'transaction_obj'} = $args{'transaction_obj'};
$self->{'type'} = $args{'type'};
+ $self->{'hints'} = $args{'hints'};
Scalar::Util::weaken( $self->{'scrip_action_obj'} );
- Scalar::Util::weaken( $self->{'scrip_obj'} );
Scalar::Util::weaken( $self->{'template_obj'} );
Scalar::Util::weaken( $self->{'ticket_obj'} );
Scalar::Util::weaken( $self->{'transaction_obj'} );
@@ -137,9 +136,9 @@
}
-sub scrip_obj {
+sub hints {
my $self = shift;
- return ( $self->{'scrip_obj'} );
+ return ( $self->{'hints'} );
}
@@ -195,7 +194,7 @@
# We need to clean up all the references that might maybe get
# oddly circular
$self->{'scrip_action_obj'} = undef;
- $self->{'scrip_obj'} = undef;
+ $self->{'hints'} = undef;
$self->{'template_obj'} = undef;
$self->{'ticket_obj'} = undef;
$self->{'transaction_obj'} = undef;
Modified: rt/3.999/branches/lorzy/t/mail/sendmail.t
==============================================================================
--- rt/3.999/branches/lorzy/t/mail/sendmail.t (original)
+++ rt/3.999/branches/lorzy/t/mail/sendmail.t Wed Feb 18 10:24:35 2009
@@ -1,7 +1,7 @@
#!/usr/bin/perl -w
use strict;
-use RT::Test; use Test::More tests => 129;
+use RT::Test; use Test::More tests => 117;
use File::Spec ();
@@ -27,7 +27,7 @@
my $self = shift;
my $MIME = shift;
- main::_fired_scrip($self->scrip_obj);
+ main::_fired_scrip('#rule');
main::is(ref($MIME) , 'MIME::Entity', "hey, look. it's a mime entity");
}
}
@@ -301,7 +301,7 @@
eval 'sub RT::ScripAction::SendEmail::send_message {
my $self = shift;
my $MIME = shift;
- return (1) unless ($self->scrip_obj->scrip_action->name eq "Notify AdminCcs" );
+ return (1) unless ($self->hints->{source_scripaction_name} eq "Notify AdminCcs" );
is ($MIME->parts, 0, "generated correspondence mime entity
does not have parts");
is ($MIME->head->mime_type , "text/plain", "The mime type is a plain");
@@ -365,7 +365,7 @@
eval 'sub RT::ScripAction::SendEmail::send_message {
my $self = shift;
my $MIME = shift;
- return (1) unless ($self->scrip_obj->scrip_action->name eq "Notify AdminCcs" );
+ return (1) unless ($self->hints->{source_scripaction_name} eq "Notify AdminCcs" );
is ($MIME->head->mime_type , "text/plain", "The only part is text/plain ");
my $subject = $MIME->head->get("subject");
chomp($subject);
@@ -408,7 +408,7 @@
eval 'sub RT::ScripAction::SendEmail::send_message {
my $self = shift;
my $MIME = shift;
- return (1) unless ($self->scrip_obj->scrip_action->name eq "Notify AdminCcs" );
+ return (1) unless ($self->hints->{source_scripaction_name} eq "Notify AdminCcs" );
is ($MIME->head->mime_type , "multipart/mixed", "It is a mixed multipart");
my $subject = $MIME->head->get("subject");
$subject = MIME::Base64::decode_base64( $subject);
More information about the Rt-commit
mailing list