[Rt-commit] r10947 - rt/branches/3.7-EXPERIMENTAL/lib/RT
ruz at bestpractical.com
ruz at bestpractical.com
Wed Feb 27 15:46:23 EST 2008
Author: ruz
Date: Wed Feb 27 15:46:12 2008
New Revision: 10947
Modified:
rt/branches/3.7-EXPERIMENTAL/lib/RT/Queue_Overlay.pm
Log:
* allow to delete queue's watcher by email as we have test for that
Modified: rt/branches/3.7-EXPERIMENTAL/lib/RT/Queue_Overlay.pm
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/lib/RT/Queue_Overlay.pm (original)
+++ rt/branches/3.7-EXPERIMENTAL/lib/RT/Queue_Overlay.pm Wed Feb 27 15:46:12 2008
@@ -806,15 +806,23 @@
PrincipalId => undef,
@_ );
- unless ($args{'PrincipalId'} ) {
- return(0, $self->loc("No principal specified"));
+ unless ( $args{'PrincipalId'} || $args{'Email'} ) {
+ return ( 0, $self->loc("No principal specified") );
+ }
+ my $principal = RT::Principal->new( $self->CurrentUser );
+ if ( $args{'PrincipalId'} ) {
+
+ $principal->Load( $args{'PrincipalId'} );
+ }
+ else {
+ my $user = RT::User->new( $self->CurrentUser );
+ $user->LoadByEmail( $args{'Email'} );
+ $principal->Load( $user->Id );
}
- my $principal = RT::Principal->new($self->CurrentUser);
- $principal->Load($args{'PrincipalId'});
# If we can't find this watcher, we need to bail.
- unless ($principal->Id) {
- return(0, $self->loc("Could not find that principal"));
+ unless ( $principal->Id ) {
+ return ( 0, $self->loc("Could not find that principal") );
}
my $group = RT::Group->new($self->CurrentUser);
More information about the Rt-commit
mailing list