[Rt-commit] r3305 - in rt/branches/QUEBEC-EXPERIMENTAL: . bin
lib/RT lib/RT/Interface lib/t/regression
jesse at bestpractical.com
jesse at bestpractical.com
Sun Jul 3 17:12:11 EDT 2005
Author: jesse
Date: Sun Jul 3 17:12:10 2005
New Revision: 3305
Modified:
rt/branches/QUEBEC-EXPERIMENTAL/ (props changed)
rt/branches/QUEBEC-EXPERIMENTAL/bin/rt-mailgate.in
rt/branches/QUEBEC-EXPERIMENTAL/lib/RT/CustomField_Overlay.pm
rt/branches/QUEBEC-EXPERIMENTAL/lib/RT/Interface/Email.pm
rt/branches/QUEBEC-EXPERIMENTAL/lib/RT/Record.pm
rt/branches/QUEBEC-EXPERIMENTAL/lib/t/regression/06mailgateway.t
Log:
r22105 at hualien: jesse | 2005-07-03 16:28:58 -0400
r22091 at hualien: jesse | 2005-07-03 16:13:10 -0400
* Disabling a new feature that might be dangerous; test fixes; cf fixes
Modified: rt/branches/QUEBEC-EXPERIMENTAL/bin/rt-mailgate.in
==============================================================================
--- rt/branches/QUEBEC-EXPERIMENTAL/bin/rt-mailgate.in (original)
+++ rt/branches/QUEBEC-EXPERIMENTAL/bin/rt-mailgate.in Sun Jul 3 17:12:10 2005
@@ -172,11 +172,14 @@
=item C<--action>
Specifies what happens to email sent to this alias. The avaliable
-basic actions are: C<correspond>, C<comment>, C<take> and C<resolve>.
-You can execute two or more actions on a single message using a C<->
-separated list. RT will execute the actions in the listed order.
-For example you can use C<take-comment>, C<correspond-resolve> or
-C<take-comment-resolve> as actions.
+basic actions are: C<correspond>, C<comment>.
+
+
+If you've set the RT configuration variable B<$RT::UnsafeEmailCommands>,
+C<take> and C<resolve> are also available. You can execute two or more
+actions on a single message using a C<-> separated list. RT will execute
+the actions in the listed order. For example you can use C<take-comment>,
+C<correspond-resolve> or C<take-comment-resolve> as actions.
Note that C<take> and C<resolve> actions ignore message text if used
alone. Include a C<comment> or C<correspond> action if you want RT
Modified: rt/branches/QUEBEC-EXPERIMENTAL/lib/RT/CustomField_Overlay.pm
==============================================================================
--- rt/branches/QUEBEC-EXPERIMENTAL/lib/RT/CustomField_Overlay.pm (original)
+++ rt/branches/QUEBEC-EXPERIMENTAL/lib/RT/CustomField_Overlay.pm Sun Jul 3 17:12:10 2005
@@ -286,7 +286,7 @@
# We only want one entry.
$CFs->RowsPerPage(1);
unless ($CFs->First) {
- return(0, $self->loc('Custom field not found'));
+ return(0);
}
return($self->Load($CFs->First->id));
Modified: rt/branches/QUEBEC-EXPERIMENTAL/lib/RT/Interface/Email.pm
==============================================================================
--- rt/branches/QUEBEC-EXPERIMENTAL/lib/RT/Interface/Email.pm (original)
+++ rt/branches/QUEBEC-EXPERIMENTAL/lib/RT/Interface/Email.pm Sun Jul 3 17:12:10 2005
@@ -807,7 +807,7 @@
return ( 0, "Message not recorded", $Ticket );
}
}
- elsif ( $action =~ /^take$/i ) {
+ elsif ($RT::UnsafeEmailCommands && $action =~ /^take$/i ) {
my ( $status, $msg ) = $Ticket->SetOwner( $CurrentUser->id );
unless ($status) {
@@ -821,7 +821,7 @@
return ( 0, "Ticket not taken", $Ticket );
}
}
- elsif ( $action =~ /^resolve$/i ) {
+ elsif ( $RT::UnsafeEmailCommands && $action =~ /^resolve$/i ) {
my ( $status, $msg ) = $Ticket->SetStatus( 'resolved' );
unless ($status) {
#Warn the sender that we couldn't actually submit the comment.
Modified: rt/branches/QUEBEC-EXPERIMENTAL/lib/RT/Record.pm
==============================================================================
--- rt/branches/QUEBEC-EXPERIMENTAL/lib/RT/Record.pm (original)
+++ rt/branches/QUEBEC-EXPERIMENTAL/lib/RT/Record.pm Sun Jul 3 17:12:10 2005
@@ -1806,13 +1806,21 @@
my $self = shift;
my $field = shift;
- my $cf = $self->LoadCustomFieldByIdentifier($field);
+ if ($field) {
+ my $cf = $self->LoadCustomFieldByIdentifier($field);
- unless ( $cf->Id ) {
- return ( 0, $self->loc( "Custom field [_1] not found", $args{'Field'} ) );
+ # we were asked to search on a custom field we couldn't fine
+ unless ( $cf->id ) {
+ return RT::ObjectCustomFieldValues->new( $self->CurrentUser );
+ }
+ return ( $cf->ValuesForObject($self) );
}
-
- return($cf->ValuesForObject($self));
+
+ # we're not limiting to a specific custom field;
+ my $ocfs = RT::ObjectCustomFieldValues->new( $self->CurrentUser );
+ $ocfs->LimitToObject($self);
+ return $ocfs;
+
}
=head2 CustomField IDENTIFER
Modified: rt/branches/QUEBEC-EXPERIMENTAL/lib/t/regression/06mailgateway.t
==============================================================================
--- rt/branches/QUEBEC-EXPERIMENTAL/lib/t/regression/06mailgateway.t (original)
+++ rt/branches/QUEBEC-EXPERIMENTAL/lib/t/regression/06mailgateway.t Sun Jul 3 17:12:10 2005
@@ -51,7 +51,7 @@
=cut
-use Test::More tests => 77;
+use Test::More tests => 57;
use RT;
RT::LoadConfig();
RT::Init();
@@ -422,6 +422,10 @@
($val,$msg) = $g->PrincipalObj->RevokeRight(Right => 'CreateTicket');
ok ($val, $msg);
+=for later
+
+TODO: {
+
# {{{ Check take and resolve actions
# create ticket that is owned by nobody
@@ -453,7 +457,9 @@
is( $tick->Owner, $RT::Nobody->Id, 'set owner back to nobody');
-ok(open(MAIL, "|$RT::BinPath/rt-mailgate --url $url --queue general --action take-correspond"), "Opened the mailgate - $@");
+
+ local $TODO = "Advanced mailgate actions require an unsafe configuration";
+ok(open(MAIL, "|$RT::BinPath/rt-mailgate --url $RT::WebURL --queue general --action take-correspond"), "Opened the mailgate - $@");
print MAIL <<EOF;
From: root\@localhost
Subject: [example.com \#$id] correspondence
@@ -490,6 +496,10 @@
is( $tick->Status, 'resolved', 'successfuly resolved ticket via email');
is( $tick->Transactions->Count, 7, 'no superfluous transactions');
+};
+
+=cut
+
# }}}
1;
More information about the Rt-commit
mailing list