[Rt-commit] r5127 - in rt/branches/3.7-EXPERIMENTAL: .
lib/RT/Interface lib/RT/Interface/Web
ruz at bestpractical.com
ruz at bestpractical.com
Thu Apr 27 20:17:10 EDT 2006
Author: ruz
Date: Thu Apr 27 20:17:09 2006
New Revision: 5127
Modified:
rt/branches/3.7-EXPERIMENTAL/ (props changed)
rt/branches/3.7-EXPERIMENTAL/lib/RT/Action/SendEmail.pm
rt/branches/3.7-EXPERIMENTAL/lib/RT/Interface/Web.pm
rt/branches/3.7-EXPERIMENTAL/lib/RT/Interface/Web/Handler.pm
Log:
r2643 at cubic-pc: cubic | 2006-04-28 02:52:50 +0400
* allow squelching on create
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 Apr 27 20:17:09 2006
@@ -450,8 +450,26 @@
# }}}
+=head2 SquelchMailTo
-# }}}
+Mark address to be removed from list of the recipients. Returns list of the addresses.
+To empty list pass undefined argument.
+
+B<Note> that this method can be called as class method and works globaly. Don't forget to
+clean this list when blocking is not required anymore.
+
+=cut
+
+{
+ my $squelch = [];
+ sub SquelchMailTo {
+ my $self = shift;
+ if ( @_ ) {
+ $squelch = [ @_ ];
+ }
+ return grep defined, @{ $squelch };
+ }
+}
# {{{ RemoveInappropriateRecipients
@@ -531,6 +549,7 @@
foreach my $attribute (@non_recipients) {
push @blacklist, $attribute->Content;
}
+ push @blacklist, $self->SquelchMailTo;
# Cycle through the people we're sending to and pull out anyone on the
# system blacklist
Modified: rt/branches/3.7-EXPERIMENTAL/lib/RT/Interface/Web.pm
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/lib/RT/Interface/Web.pm (original)
+++ rt/branches/3.7-EXPERIMENTAL/lib/RT/Interface/Web.pm Thu Apr 27 20:17:09 2006
@@ -271,6 +271,15 @@
my @Cc = split /\s*,\s*/, ( $ARGS{'Cc'} || '' );
my @AdminCc = split /\s*,\s*/, ( $ARGS{'AdminCc'} || '' );
+ my @temp_squelch;
+ push @temp_squelch, @Requestors if grep $_ eq 'Requestors', @{ $ARGS{'SkipNotification'} || [] };
+ push @temp_squelch, @Cc if grep $_ eq 'Cc', @{ $ARGS{'SkipNotification'} || [] };
+ push @temp_squelch, @AdminCc if grep $_ eq 'AdminCc', @{ $ARGS{'SkipNotification'} || [] };
+ if ( @temp_squelch ) {
+ require RT::Action::SendEmail;
+ RT::Action::SendEmail->SquelchMailTo( RT::Action::SendEmail->SquelchMailTo, @temp_squelch );
+ }
+
my $MIMEObj = MakeMIMEEntity(
Subject => $ARGS{'Subject'},
From => $ARGS{'From'},
Modified: rt/branches/3.7-EXPERIMENTAL/lib/RT/Interface/Web/Handler.pm
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/lib/RT/Interface/Web/Handler.pm (original)
+++ rt/branches/3.7-EXPERIMENTAL/lib/RT/Interface/Web/Handler.pm Thu Apr 27 20:17:09 2006
@@ -204,6 +204,9 @@
and UNIVERSAL::can(
'DBIx::SearchBuilder::Record::Cachable' => 'FlushCache' ) );
+ # cleanup global squelching of the mails
+ require RT::Action::SendEmail;
+ RT::Action::SendEmail->SquelchMailTo( undef );
}
# }}}
More information about the Rt-commit
mailing list