[rt-users] Re: [fsck.com #5286] User Autocreated 'when added as a watcher' != 'on ticket submission'
Paulo Matos
pjsm at fct.unl.pt
Thu Feb 19 11:15:05 EST 2004
Patch provided to solve this problem...
Fixes also minor typo described on #5157
--
Paulo Matos
-------------- next part --------------
#
# rt-3.0.8-Autocreation_with_name.patch
#
# * 2004.02.19 Paulo Matos <paulo.matos at fct.unl.pt>
#
# Solves
# rt3 #5286
# - User Autocreated 'when added as a watcher' != 'on ticket submission'
# rt3 #5157
# - typo in User_Overlay.pm (line 301)
#
diff -uNr RT.orig/Queue_Overlay.pm RT/Queue_Overlay.pm
--- RT.orig/Queue_Overlay.pm Wed Feb 18 01:50:37 2004
+++ RT/Queue_Overlay.pm Mon Feb 16 15:38:33 2004
@@ -48,6 +48,7 @@
use vars qw(@STATUS @ACTIVE_STATUS @INACTIVE_STATUS $RIGHTS);
use RT::Groups;
use RT::ACL;
+use RT::EmailParser;
@ACTIVE_STATUS = qw(new open stalled);
@@ -602,10 +603,13 @@
# if the user doesn't exist, we need to create a new user
my $new_user = RT::User->new($RT::SystemUser);
+ my ( $Address, $Name ) =
+ RT::EmailParser::ParseAddressFromHeader('', $args{'Email'});
+
my ( $Val, $Message ) = $new_user->Create(
- Name => $args{'Email'},
- EmailAddress => $args{'Email'},
- RealName => $args{'Email'},
+ Name => $Address,
+ EmailAddress => $Address,
+ RealName => $Name,
Privileged => 0,
Comments => 'Autocreated when added as a watcher');
unless ($Val) {
diff -uNr RT.orig/User_Overlay.pm RT/User_Overlay.pm
--- RT.orig/User_Overlay.pm Wed Feb 18 01:50:37 2004
+++ RT/User_Overlay.pm Wed Feb 18 02:34:32 2004
@@ -53,6 +53,7 @@
use Digest::MD5;
use RT::Principals;
use RT::ACE;
+use RT::EmailParser;
# {{{ sub _Accessible
@@ -298,7 +299,7 @@
unless ($stash_id) {
$RT::Handle->Rollback();
- $RT::Logger->crit("Couldn't stash the user in groumembers");
+ $RT::Logger->crit("Couldn't stash the user in groupmembers");
return ( 0, $self->loc('Could not create user') );
}
@@ -576,13 +577,17 @@
my ($val, $message);
+ my ( $Address, $Name ) =
+ RT::EmailParser::ParseAddressFromHeader('', $email);
+ $email = $Address;
+
$self->LoadByEmail($email);
$message = $self->loc('User loaded');
unless ($self->Id) {
( $val, $message ) = $self->Create(
Name => $email,
EmailAddress => $email,
- RealName => $email,
+ RealName => $Name,
Privileged => 0,
Comments => 'Autocreated when added as a watcher');
unless ($val) {
More information about the rt-users
mailing list