[Rt-commit] r5790 - in RT-Extension-CommandByEmail: .
kevinr at bestpractical.com
kevinr at bestpractical.com
Tue Aug 22 00:42:58 EDT 2006
Author: kevinr
Date: Tue Aug 22 00:42:49 2006
New Revision: 5790
Modified:
RT-Extension-CommandByEmail/ (props changed)
RT-Extension-CommandByEmail/lib/RT/Interface/Email/Filter/TakeAction.pm
Log:
r25588 at SAD-GIRL-IN-SNOW: kevinr | 2006-08-21 23:51:04 -0400
* Accept watchers as e-mail addresses or usernames
Modified: RT-Extension-CommandByEmail/lib/RT/Interface/Email/Filter/TakeAction.pm
==============================================================================
--- RT-Extension-CommandByEmail/lib/RT/Interface/Email/Filter/TakeAction.pm (original)
+++ RT-Extension-CommandByEmail/lib/RT/Interface/Email/Filter/TakeAction.pm Tue Aug 22 00:42:49 2006
@@ -255,24 +255,30 @@
$args{'Ticket'}->$method->MemberEmailAddresses;
} ];
my ($add, $del) = _CompileAdditiveForUpdate( %tmp );
- foreach ( @$del ) {
+ foreach my $text ( @$del ) {
+ my $user = RT::User->new($RT::SystemUser);
+ $user->LoadByEmail($text) if $text =~ /\@/;
+ $user->Load($text) unless $user->id;
my ( $val, $msg ) = $ticket_as_user->DeleteWatcher(
Type => $type,
- Email => $_,
+ PrincipalId => $user->PrincipalId,
);
push @{ $results{ 'Del'. $type } }, {
- value => $_,
+ value => $text,
result => $val,
message => $msg
};
}
- foreach ( @$add ) {
+ foreach my $text ( @$add ) {
+ my $user = RT::User->new($RT::SystemUser);
+ $user->LoadByEmail($text) if $text =~ /\@/;
+ $user->Load($text) unless $user->id;
my ( $val, $msg ) = $ticket_as_user->AddWatcher(
Type => $type,
- Email => $_,
+ PrincipalId => $user->PrincipalId,
);
push @{ $results{ 'Add'. $type } }, {
- value => $_,
+ value => $text,
result => $val,
message => $msg
};
More information about the Rt-commit
mailing list