[Rt-commit] r6812 - rt/branches/3.6-RELEASE/lib/RT/Action
ruz at bestpractical.com
ruz at bestpractical.com
Fri Jan 26 10:34:58 EST 2007
Author: ruz
Date: Fri Jan 26 10:34:57 2007
New Revision: 6812
Modified:
rt/branches/3.6-RELEASE/lib/RT/Action/SendEmail.pm
Log:
* if we have subject line regexp then we should use it during mail sending.
This will allow us to send email with any token we want that matches the
regexp, by defining it in a template. So now it's possible to use:
Subject: [not-rtname-token-that-match-re #{ $Ticket->id }] ...
Modified: rt/branches/3.6-RELEASE/lib/RT/Action/SendEmail.pm
==============================================================================
--- rt/branches/3.6-RELEASE/lib/RT/Action/SendEmail.pm (original)
+++ rt/branches/3.6-RELEASE/lib/RT/Action/SendEmail.pm Fri Jan 26 10:34:57 2007
@@ -770,13 +770,18 @@
sub SetSubjectToken {
my $self = shift;
- my $tag = "[$RT::rtname #" . $self->TicketObj->id . "]";
my $sub = $self->TemplateObj->MIMEObj->head->get('Subject');
- unless ( $sub =~ /\Q$tag\E/ ) {
- $sub =~ s/(\r\n|\n|\s)/ /gi;
- chomp $sub;
- $self->TemplateObj->MIMEObj->head->replace( 'Subject', "$tag $sub" );
- }
+ my $id = $self->TicketObj->id;
+
+ my $token_re = $RT::EmailSubjectTagRegex;
+ $token_re = qr/\Q$RT::rtname\E/o unless $token_re;
+ return if $sub =~ /\[$token_re\s+#$id\]/;
+
+ $sub =~ s/(\r\n|\n|\s)/ /gi;
+ chomp $sub;
+ $self->TemplateObj->MIMEObj->head->replace(
+ Subject => "[$RT::rtname #$id] $sub",
+ );
}
# }}}
More information about the Rt-commit
mailing list