[Rt-commit] r10641 - in rt/branches/3.999-DANGEROUS: html/REST/1.0/Forms/ticket lib/RT lib/RT/Interface lib/RT/Model lib/RT/ScripAction t/api
ruz at bestpractical.com
ruz at bestpractical.com
Thu Jan 31 21:05:20 EST 2008
Author: ruz
Date: Thu Jan 31 21:05:20 2008
New Revision: 10641
Modified:
rt/branches/3.999-DANGEROUS/html/REST/1.0/Forms/ticket/default
rt/branches/3.999-DANGEROUS/lib/RT/Interface/Web.pm
rt/branches/3.999-DANGEROUS/lib/RT/Model/Queue.pm
rt/branches/3.999-DANGEROUS/lib/RT/Model/Ticket.pm
rt/branches/3.999-DANGEROUS/lib/RT/Record.pm
rt/branches/3.999-DANGEROUS/lib/RT/ScripAction/CreateTickets.pm
rt/branches/3.999-DANGEROUS/t/api/queue.t
rt/branches/3.999-DANGEROUS/t/api/ticket.t
rt/branches/3.999-DANGEROUS/t/ticket/linking.t
Log:
* Queue/Ticket models
Modified: rt/branches/3.999-DANGEROUS/html/REST/1.0/Forms/ticket/default
==============================================================================
--- rt/branches/3.999-DANGEROUS/html/REST/1.0/Forms/ticket/default (original)
+++ rt/branches/3.999-DANGEROUS/html/REST/1.0/Forms/ticket/default Thu Jan 31 21:05:20 2008
@@ -279,7 +279,7 @@
foreach $p (keys %old) {
unless (exists $new{$p}) {
($s, $n) = $ticket->delete_watcher(type => $type,
- Email => $p);
+ email => $p);
push @msgs, [ $s, $n ];
}
}
@@ -291,9 +291,9 @@
push @msgs, [ $s, $n ];
next;
}
- unless ($ticket->is_watcher(type => $type, Email => $p)) {
+ unless ($ticket->is_watcher(type => $type, email => $p)) {
($s, $n) = $ticket->add_watcher(type => $type,
- Email => $p);
+ email => $p);
push @msgs, [ $s, $n ];
}
}
Modified: rt/branches/3.999-DANGEROUS/lib/RT/Interface/Web.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/Interface/Web.pm (original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/Interface/Web.pm Thu Jan 31 21:05:20 2008
@@ -1189,7 +1189,7 @@
# Delete watchers in the simple style demanded by the bulk manipulator
elsif ( $key =~ /^Delete(Requestor|Cc|AdminCc)$/ ) {
my ( $code, $msg ) = $Ticket->delete_watcher(
- Email => $ARGSRef->{$key},
+ email => $ARGSRef->{$key},
type => $1
);
push @results, $msg;
@@ -1203,7 +1203,7 @@
#They're in this order because otherwise $1 gets clobbered :/
my ( $code, $msg ) = $Ticket->add_watcher(
type => $ARGSRef->{$key},
- Email => $ARGSRef->{ "WatcherAddressEmail" . $1 }
+ email => $ARGSRef->{ "WatcherAddressEmail" . $1 }
);
push @results, $msg;
}
@@ -1212,7 +1212,7 @@
elsif ( $key =~ /^Add(Requestor|Cc|AdminCc)$/ ) {
my ( $code, $msg ) = $Ticket->add_watcher(
type => $1,
- Email => $ARGSRef->{$key}
+ email => $ARGSRef->{$key}
);
push @results, $msg;
}
Modified: rt/branches/3.999-DANGEROUS/lib/RT/Model/Queue.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/Model/Queue.pm (original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/Model/Queue.pm Thu Jan 31 21:05:20 2008
@@ -168,7 +168,7 @@
target => '',
base => '',
type => '',
- Silent => undef,
+ silent => undef,
@_
);
@@ -696,7 +696,7 @@
my %args = (
type => undef,
principal_id => undef,
- Email => undef,
+ email => undef,
@_
);
@@ -753,22 +753,22 @@
my $self = shift;
my %args = (
type => undef,
- Silent => undef,
+ silent => undef,
principal_id => undef,
- Email => undef,
+ email => undef,
@_
);
my $principal = RT::Model::Principal->new;
if ( $args{'principal_id'} ) {
$principal->load( $args{'principal_id'} );
- } elsif ( $args{'Email'} ) {
+ } elsif ( $args{'email'} ) {
my $user = RT::Model::User->new;
- $user->load_by_email( $args{'Email'} );
+ $user->load_by_email( $args{'email'} );
unless ( $user->id ) {
- $user->load( $args{'Email'} );
+ $user->load( $args{'email'} );
}
if ( $user->id ) { # If the user exists
$principal->load( $user->principal_id );
@@ -780,7 +780,7 @@
my ( $Address, $name )
= RT::Interface::Email::parse_address_from_header(
- $args{'Email'} );
+ $args{'email'} );
my ( $Val, $Message ) = $new_user->create(
name => $Address,
@@ -791,11 +791,11 @@
);
unless ($Val) {
Jifty->log->error( "Failed to create user "
- . $args{'Email'} . ": "
+ . $args{'email'} . ": "
. $Message );
# Deal with the race condition of two account creations at once
- $new_user->load_by_email( $args{'Email'} );
+ $new_user->load_by_email( $args{'email'} );
}
$principal->load( $new_user->principal_id );
}
Modified: rt/branches/3.999-DANGEROUS/lib/RT/Model/Ticket.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/Model/Ticket.pm (original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/Model/Ticket.pm Thu Jan 31 21:05:20 2008
@@ -625,7 +625,7 @@
my ( $val, $msg ) = $self->$method(
type => $type,
principal_id => $watcher,
- Silent => 1,
+ silent => 1,
);
push @non_fatal_errors,
_( "Couldn't set %1 watcher: %2", $type, $msg )
@@ -700,8 +700,8 @@
my ( $wval, $wmsg ) = $self->_add_link(
type => $LINKTYPEMAP{$type}->{'type'},
$LINKTYPEMAP{$type}->{'Mode'} => $link,
- Silent => !$args{'_record_transaction'},
- 'Silent'
+ silent => !$args{'_record_transaction'},
+ 'silent_'
. (
$LINKTYPEMAP{$type}->{'Mode'} eq 'base'
? 'target'
@@ -1028,20 +1028,20 @@
my $watcher;
foreach $watcher ( @{ $args{'Cc'} } ) {
- $self->_add_watcher( type => 'Cc', Email => $watcher, Silent => 1 );
+ $self->_add_watcher( type => 'Cc', email => $watcher, silent => 1 );
}
foreach $watcher ( @{ $args{'AdminCc'} } ) {
$self->_add_watcher(
type => 'AdminCc',
- Email => $watcher,
- Silent => 1
+ email => $watcher,
+ silent => 1
);
}
foreach $watcher ( @{ $args{'Requestor'} } ) {
$self->_add_watcher(
type => 'Requestor',
- Email => $watcher,
- Silent => 1
+ email => $watcher,
+ silent => 1
);
}
@@ -1122,10 +1122,10 @@
prinicpal_id The RT::Model::Principal id of the user or group that's being added as a watcher
-Email The email address of the new watcher. If a user with this
+email The email address of the new watcher. If a user with this
email address can't be found, a new nonprivileged user will be created.
-If the watcher you\'re trying to set has an RT account, set the Owner paremeter to their User Id. Otherwise, set the Email parameter to their Email address.
+If the watcher you\'re trying to set has an RT account, set the Owner paremeter to their User Id. Otherwise, set the email parameter to their email address.
=cut
@@ -1134,7 +1134,7 @@
my %args = (
type => undef,
principal_id => undef,
- Email => undef,
+ email => undef,
@_
);
@@ -1142,17 +1142,17 @@
return $self->_add_watcher(%args)
if $self->current_user_has_right('ModifyTicket');
- if ( $args{'Email'} ) {
- my ($addr) = Mail::Address->parse( $args{'Email'} );
+ if ( $args{'email'} ) {
+ my ($addr) = Mail::Address->parse( $args{'email'} );
return ( 0,
- _( "Couldn't parse address from '%1 string", $args{'Email'} ) )
+ _( "Couldn't parse address from '%1 string", $args{'email'} ) )
unless $addr;
if (lc $self->current_user->user_object->email eq
lc RT::Model::User->canonicalize_email( $addr->address ) )
{
$args{'principal_id'} = $self->current_user->id;
- delete $args{'Email'};
+ delete $args{'email'};
}
}
@@ -1190,16 +1190,16 @@
my $self = shift;
my %args = (
type => undef,
- Silent => undef,
+ silent => undef,
principal_id => undef,
- Email => undef,
+ email => undef,
@_
);
my $principal = RT::Model::Principal->new;
- if ( $args{'Email'} ) {
+ if ( $args{'email'} ) {
my $user = RT::Model::User->new( current_user => RT->system_user );
- my ( $pid, $msg ) = $user->load_or_create_by_email( $args{'Email'} );
+ my ( $pid, $msg ) = $user->load_or_create_by_email( $args{'email'} );
$args{'principal_id'} = $pid if $pid;
}
if ( $args{'principal_id'} ) {
@@ -1210,7 +1210,7 @@
unless ( $principal->id ) {
Jifty->log->error(
"Could not load create a user with the email address '"
- . $args{'Email'}
+ . $args{'email'}
. "' to add as a watcher for ticket "
. $self->id );
return ( 0, _("Could not find or create that user") );
@@ -1254,7 +1254,7 @@
);
}
- unless ( $args{'Silent'} ) {
+ unless ( $args{'silent'} ) {
$self->_new_transaction(
type => 'AddWatcher',
new_value => $principal->id,
@@ -1270,7 +1270,7 @@
# {{{ sub delete_watcher
-=head2 delete_watcher { type => TYPE, principal_id => PRINCIPAL_ID, Email => EMAIL_ADDRESS }
+=head2 delete_watcher { type => TYPE, principal_id => PRINCIPAL_ID, email => EMAIL_ADDRESS }
Deletes a ticket watcher. Takes two arguments:
@@ -1281,7 +1281,7 @@
principal_id (an RT::Model::Principal id of the watcher you want to remove)
OR
-Email (the email address of an existing wathcer)
+email (the email address of an existing wathcer)
=cut
@@ -1292,11 +1292,11 @@
my %args = (
type => undef,
principal_id => undef,
- Email => undef,
+ email => undef,
@_
);
- unless ( $args{'principal_id'} || $args{'Email'} ) {
+ unless ( $args{'principal_id'} || $args{'email'} ) {
return ( 0, _("No principal specified") );
}
my $principal = RT::Model::Principal->new;
@@ -1305,7 +1305,7 @@
$principal->load( $args{'principal_id'} );
} else {
my $user = RT::Model::User->new;
- $user->load_by_email( $args{'Email'} );
+ $user->load_by_email( $args{'email'} );
$principal->load( $user->id );
}
@@ -1388,7 +1388,7 @@
);
}
- unless ( $args{'Silent'} ) {
+ unless ( $args{'silent'} ) {
$self->_new_transaction(
type => 'del_watcher',
old_value => $principal->id,
@@ -1594,13 +1594,13 @@
# {{{ sub is_watcher
# a generic routine to be called by is_requestor, is_cc and is_admin_cc
-=head2 is_watcher { type => TYPE, principal_id => PRINCIPAL_ID, Email => EMAIL }
+=head2 is_watcher { type => TYPE, principal_id => PRINCIPAL_ID, email => EMAIL }
-Takes a param hash with the attributes type and either principal_id or Email
+Takes a param hash with the attributes type and either principal_id or email
Type is one of Requestor, Cc, AdminCc and Owner
-principal_id is an RT::Model::Principal id, and Email is an email address.
+principal_id is an RT::Model::Principal id, and email is an email address.
Returns true if the specified principal (or the one corresponding to the
specified address) is a member of the group type for this ticket.
@@ -1615,7 +1615,7 @@
my %args = (
type => 'Requestor',
principal_id => undef,
- Email => undef,
+ email => undef,
@_
);
@@ -1627,11 +1627,11 @@
);
# Find the relevant principal.
- if ( !$args{principal_id} && $args{Email} ) {
+ if ( !$args{principal_id} && $args{email} ) {
# Look up the specified user.
my $user = RT::Model::User->new;
- $user->load_by_email( $args{Email} );
+ $user->load_by_email( $args{email} );
if ( $user->id ) {
$args{principal_id} = $user->principal_id;
} else {
@@ -2357,13 +2357,13 @@
=head2 delete_link
-Delete a link. takes a paramhash of base, target, Type, Silent,
-Silentbase and Silenttarget. Either base or target must be null.
+Delete a link. takes a paramhash of base, target, Type, silent,
+silent_base and silent_target. Either base or target must be null.
The null value will be replaced with this ticket\'s id.
-If Silent is true then no transaction would be recorded, in other
+If silent is true then no transaction would be recorded, in other
case you can control creation of transactions on both base and
-target with Silentbase and Silenttarget respectively. By default
+target with silent_base and silent_target respectively. By default
both transactions are created.
=cut
@@ -2374,9 +2374,9 @@
base => undef,
target => undef,
type => undef,
- Silent => undef,
- Silentbase => undef,
- Silenttarget => undef,
+ silent => undef,
+ silent_base => undef,
+ silent_target => undef,
@_
);
@@ -2412,7 +2412,7 @@
my ( $val, $Msg ) = $self->SUPER::_delete_link(%args);
return ( 0, $Msg ) unless $val;
- return ( $val, $Msg ) if $args{'Silent'};
+ return ( $val, $Msg ) if $args{'silent'};
my ( $direction, $remote_link );
@@ -2427,7 +2427,7 @@
my $remote_uri = RT::URI->new;
$remote_uri->from_uri($remote_link);
- unless ( $args{ 'Silent' . $direction } ) {
+ unless ( $args{ 'silent_' . $direction } ) {
my ( $Trans, $Msg, $TransObj ) = $self->_new_transaction(
type => 'DeleteLink',
field => $LINKDIRMAP{ $args{'type'} }->{$direction},
@@ -2437,7 +2437,7 @@
Jifty->log->error("Couldn't create transaction: $Msg") unless $Trans;
}
- if ( !$args{ 'Silent' . ( $direction eq 'target' ? 'base' : 'target' ) }
+ if ( !$args{ 'silent_' . ( $direction eq 'target' ? 'base' : 'target' ) }
&& $remote_uri->is_local )
{
my $OtherObj = $remote_uri->object;
@@ -2464,9 +2464,9 @@
Takes a paramhash of type and one of base or target. Adds that link to this ticket.
-If Silent is true then no transaction would be recorded, in other
+If silent is true then no transaction would be recorded, in other
case you can control creation of transactions on both base and
-target with Silentbase and Silenttarget respectively. By default
+target with silent_base and silent_target respectively. By default
both transactions are created.
=cut
@@ -2477,9 +2477,9 @@
target => '',
base => '',
type => '',
- Silent => undef,
- Silentbase => undef,
- Silenttarget => undef,
+ silent => undef,
+ silent_base => undef,
+ silent_target => undef,
@_
);
@@ -2547,15 +2547,15 @@
target => '',
base => '',
type => '',
- Silent => undef,
- Silentbase => undef,
- Silenttarget => undef,
+ silent => undef,
+ silent_base => undef,
+ silent_target => undef,
@_
);
my ( $val, $msg, $exist ) = $self->SUPER::_add_link(%args);
return ( $val, $msg ) if !$val || $exist;
- return ( $val, $msg ) if $args{'Silent'};
+ return ( $val, $msg ) if $args{'silent'};
my ( $direction, $remote_link );
if ( $args{'target'} ) {
@@ -2569,7 +2569,7 @@
my $remote_uri = RT::URI->new;
$remote_uri->from_uri($remote_link);
- unless ( $args{ 'Silent' . $direction } ) {
+ unless ( $args{ 'silent_' . $direction } ) {
my ( $Trans, $Msg, $TransObj ) = $self->_new_transaction(
type => 'AddLink',
field => $LINKDIRMAP{ $args{'type'} }->{$direction},
@@ -2579,7 +2579,7 @@
Jifty->log->error("Couldn't create transaction: $Msg") unless $Trans;
}
- if ( !$args{ 'Silent' . ( $direction eq 'target' ? 'base' : 'target' ) }
+ if ( !$args{ 'silent_' . ( $direction eq 'target' ? 'base' : 'target' ) }
&& $remote_uri->is_local )
{
my $OtherObj = $remote_uri->object;
@@ -2751,7 +2751,7 @@
my ( $val, $msg ) = $MergeInto->_add_watcher(
type => $addwatcher_type,
- Silent => 1,
+ silent => 1,
principal_id => $watcher->member_id
);
unless ($val) {
Modified: rt/branches/3.999-DANGEROUS/lib/RT/Record.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/Record.pm (original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/Record.pm Thu Jan 31 21:05:20 2008
@@ -1080,7 +1080,7 @@
target => '',
base => '',
type => '',
- Silent => undef,
+ silent => undef,
@_
);
Modified: rt/branches/3.999-DANGEROUS/lib/RT/ScripAction/CreateTickets.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/ScripAction/CreateTickets.pm (original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/ScripAction/CreateTickets.pm Thu Jan 31 21:05:20 2008
@@ -1240,7 +1240,7 @@
my ( $wval, $wmsg ) = $ticket->add_link(
type => $LINKTYPEMAP{$type}->{'type'},
$LINKTYPEMAP{$type}->{'Mode'} => $link,
- Silent => 1
+ silent => 1
);
Jifty->log->warn("add_link thru $link failed: $wmsg")
Modified: rt/branches/3.999-DANGEROUS/t/api/queue.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/api/queue.t (original)
+++ rt/branches/3.999-DANGEROUS/t/api/queue.t Thu Jan 31 21:05:20 2008
@@ -79,7 +79,7 @@
ok ($group->id, "Found the ccs object for this Queue");
-ok (my ($add_id, $add_msg) = $Queue->add_watcher(type => 'Cc', Email => 'bob at fsck.com'), "Added bob at fsck.com as a cc");
+ok (my ($add_id, $add_msg) = $Queue->add_watcher(type => 'Cc', email => 'bob at fsck.com'), "Added bob at fsck.com as a cc");
ok ($add_id, "Add succeeded: ($add_msg)");
ok(my $bob = RT::Model::User->new(current_user => RT->system_user), "Creating a bob rt::user");
$bob->load_by_email('bob at fsck.com');
Modified: rt/branches/3.999-DANGEROUS/t/api/ticket.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/api/ticket.t (original)
+++ rt/branches/3.999-DANGEROUS/t/api/ticket.t Thu Jan 31 21:05:20 2008
@@ -118,13 +118,13 @@
ok ($ticket->is_watcher(type => 'Requestor', principal_id => $jesse->principal_id), "The ticket actually has jesse at fsck.com as a requestor");
-ok (my ($add_id, $add_msg) = $ticket->add_watcher(type => 'Requestor', Email => 'bob at fsck.com'), "Added bob at fsck.com as a requestor");
+ok (my ($add_id, $add_msg) = $ticket->add_watcher(type => 'Requestor', email => 'bob at fsck.com'), "Added bob at fsck.com as a requestor");
ok ($add_id, "Add succeeded: ($add_msg)");
ok(my $bob = RT::Model::User->new(current_user => RT->system_user), "Creating a bob rt::user");
$bob->load_by_email('bob at fsck.com');
ok($bob->id, "Found the bob rt user");
ok ($ticket->is_watcher(type => 'Requestor', principal_id => $bob->principal_id), "The ticket actually has bob at fsck.com as a requestor");;
-ok ( ($add_id, $add_msg) = $ticket->delete_watcher(type =>'Requestor', Email => 'bob at fsck.com'), "Added bob at fsck.com as a requestor");
+ok ( ($add_id, $add_msg) = $ticket->delete_watcher(type =>'Requestor', email => 'bob at fsck.com'), "Added bob at fsck.com as a requestor");
ok (!$ticket->is_watcher(type => 'Requestor', principal_id => $bob->principal_id), "The ticket no longer has bob at fsck.com as a requestor");;
Modified: rt/branches/3.999-DANGEROUS/t/ticket/linking.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/ticket/linking.t (original)
+++ rt/branches/3.999-DANGEROUS/t/ticket/linking.t Thu Jan 31 21:05:20 2008
@@ -246,7 +246,7 @@
is(link_count($filename), 0, "scrips ok");
# tests for silent behaviour
-($id,$msg) = $ticket->add_link(type => 'RefersTo', target => $ticket2->id, Silent => 1);
+($id,$msg) = $ticket->add_link(type => 'RefersTo', target => $ticket2->id, silent => 1);
ok($id,$msg);
is(link_count($filename), 0, "scrips ok");
{
@@ -259,11 +259,11 @@
is( $transactions->count, 2, "Still two txns on the target" );
}
-($id,$msg) =$ticket->delete_link(type => 'RefersTo', target => $ticket2->id, Silent => 1);
+($id,$msg) =$ticket->delete_link(type => 'RefersTo', target => $ticket2->id, silent => 1);
ok($id,$msg);
is(link_count($filename), 0, "scrips ok");
-($id,$msg) = $ticket->add_link(type => 'RefersTo', target => $ticket2->id, Silentbase => 1);
+($id,$msg) = $ticket->add_link(type => 'RefersTo', target => $ticket2->id, silent_base => 1);
ok($id,$msg);
is(link_count($filename), 1, "scrips ok");
{
@@ -276,11 +276,11 @@
is( $transactions->count, 3, "+1 txn on the target" );
}
-($id,$msg) =$ticket->delete_link(type => 'RefersTo', target => $ticket2->id, Silentbase => 1);
+($id,$msg) =$ticket->delete_link(type => 'RefersTo', target => $ticket2->id, silent_base => 1);
ok($id,$msg);
is(link_count($filename), 0, "scrips ok");
-($id,$msg) = $ticket->add_link(type => 'RefersTo', target => $ticket2->id, Silenttarget => 1);
+($id,$msg) = $ticket->add_link(type => 'RefersTo', target => $ticket2->id, silent_target => 1);
ok($id,$msg);
is(link_count($filename), 1, "scrips ok");
{
@@ -292,7 +292,7 @@
$transactions->limit( column => 'type', value => 'AddLink' );
is( $transactions->count, 3, "three txns on the target" );
}
-($id,$msg) =$ticket->delete_link(type => 'RefersTo', target => $ticket2->id, Silenttarget => 1);
+($id,$msg) =$ticket->delete_link(type => 'RefersTo', target => $ticket2->id, silent_target => 1);
ok($id,$msg);
is(link_count($filename), 0, "scrips ok");
More information about the Rt-commit
mailing list