Patch: AlwaysNotifyActor usable in RT::Action::NotifyGroup
Nathan Boddy <[email protected]> Thu, 4 Dec 2014 22:05:53 +1100
| Newsgroups | gmane.comp.bug-tracking.request-tracker.devel |
|---|---|
| Message-ID | <CADcRiorM+QTx3MyZwcA_3_Xe3Ht1BME_dZx5JnOFUsnnOgcf6w@mail.gmail.com> |
Hi RT Devs, Many thanks for a great product. I wanted the AlwaysNotifyActor feature from RT::Action::Notify in NotifyGroup and found it pretty easy to implement. Removed NotifyActor checking from NotifyGroup and left it to the parent Notify class. There were no tests related to these files so I have not added any. Hope this helps. This would be my first open source contribution so any feedback appreciated. Regards, Nathan
0001-AlwaysNotifyActor-can-now-be-used-in-RT-Action-Notif.patch
(application/octet-stream, 1.7 KB)
From e638631219dd5105ae6e838a22fbc1f761d2b522 Mon Sep 17 00:00:00 2001 From: Nathan A Boddy <[email protected]> Date: Thu, 4 Dec 2014 05:24:33 -0500 Subject: [PATCH] AlwaysNotifyActor can now be used in RT::Action::NotifyGroup arguments. Handled by the parent class RT::Action::Notify. --- lib/RT/Action/NotifyGroup.pm | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/lib/RT/Action/NotifyGroup.pm b/lib/RT/Action/NotifyGroup.pm index 789c182..6d2b9d7 100644 --- a/lib/RT/Action/NotifyGroup.pm +++ b/lib/RT/Action/NotifyGroup.pm @@ -73,6 +73,10 @@ require RT::Group; =head2 SetRecipients Sets the recipients of this message to Groups and/or Users. +Explicitly B<does not> notify the creator of the transaction by default. + +To send email to the selected receipients regardless of RT's NotifyActor +configuration, include AlwaysNotifyActor in the list of arguments. =cut @@ -84,16 +88,6 @@ sub SetRecipients { $self->_HandleArgument( $_ ); } - my $creatorObj = $self->TransactionObj->CreatorObj; - my $creator = $creatorObj->EmailAddress(); - - my $TransactionCurrentUser = RT::CurrentUser->new; - $TransactionCurrentUser->LoadByName($creatorObj->Name); - - unless (RT->Config->Get('NotifyActor',$TransactionCurrentUser)) { - @{ $self->{'To'} } = grep ( !/^\Q$creator\E$/, @{ $self->{'To'} } ); - } - $self->{'seen_ueas'} = {}; return 1; @@ -103,6 +97,8 @@ sub _HandleArgument { my $self = shift; my $instance = shift; + return if ( $instance =~ /^AlwaysNotifyActor$/ ); + if ( $instance !~ /\D/ ) { my $obj = RT::Principal->new( $self->CurrentUser ); $obj->Load( $instance ); -- 1.9.1