[Bps-public-commit] RT-Extension-CommandByMail branch, master, updated. 0.13-1-g216c0f0

? sunnavy sunnavy at bestpractical.com
Thu Oct 3 09:50:50 EDT 2013


The branch, master has been updated
       via  216c0f0ffcdbaf085f239a3f53dab3fecc97c154 (commit)
      from  c506c8efcb86754c21e92be22ee5912ab0ce58e8 (commit)

Summary of changes:
 lib/RT/Interface/Email/Filter/TakeAction.pm | 5 +++--
 t/create.t                                  | 5 +++--
 t/update.t                                  | 8 +++++---
 3 files changed, 11 insertions(+), 7 deletions(-)

- Log -----------------------------------------------------------------
commit 216c0f0ffcdbaf085f239a3f53dab3fecc97c154
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Thu Oct 3 21:46:10 2013 +0800

    make it compatible with 4.2
    
    2 changes:
    
    * LINKTYPEMAP
    * circular links are not allowed

diff --git a/lib/RT/Interface/Email/Filter/TakeAction.pm b/lib/RT/Interface/Email/Filter/TakeAction.pm
index cf7843a..cb409ae 100644
--- a/lib/RT/Interface/Email/Filter/TakeAction.pm
+++ b/lib/RT/Interface/Email/Filter/TakeAction.pm
@@ -387,8 +387,9 @@ sub GetCurrentUser {
             my %tmp = _ParseAdditiveCommand( \%cmds, 1, $type );
             next unless keys %tmp;
 
-            my $link_type = $ticket_as_user->LINKTYPEMAP->{ $type }->{'Type'};
-            my $link_mode = $ticket_as_user->LINKTYPEMAP->{ $type }->{'Mode'};
+            my $typemap   = keys %RT::Link::TYPEMAP ? \%RT::Link::TYPEMAP : $ticket_as_user->LINKTYPEMAP;
+            my $link_type = $typemap->{$type}->{'Type'};
+            my $link_mode = $typemap->{$type}->{'Mode'};
 
             $tmp{'Default'} = [ do {
                 my %h = ( Base => 'Target', Target => 'Base' );
diff --git a/t/create.t b/t/create.t
index 08dd850..b098d49 100644
--- a/t/create.t
+++ b/t/create.t
@@ -229,8 +229,9 @@ END
     ok($links, "ticket has links");
     is($links->Count, 1, "one link");
 
-    my $link_type = $obj->LINKTYPEMAP->{ $field }->{'Type'};
-    my $link_mode = $obj->LINKTYPEMAP->{ $field }->{'Mode'};
+    my $typemap = keys %RT::Link::TYPEMAP ? \%RT::Link::TYPEMAP : $obj->LINKTYPEMAP;
+    my $link_type = $typemap->{ $field }->{'Type'};
+    my $link_mode = $typemap->{ $field }->{'Mode'};
 
     my $link = $links->First;
     is($link->Type, $link_type, "correct type");
diff --git a/t/update.t b/t/update.t
index 86a9355..be8b415 100644
--- a/t/update.t
+++ b/t/update.t
@@ -236,7 +236,7 @@ END
 }
 
 diag("set links on update") if $ENV{'TEST_VERBOSE'};
-foreach my $field ( qw(DependsOn DependedOnBy RefersTo ReferredToBy Members MemberOf) ) {
+foreach my $field ( qw(DependsOn DependedOnBy RefersTo ReferredToBy MemberOf Members) ) {
     diag("test $field command") if $ENV{'TEST_VERBOSE'};
     my $text = <<END;
 Subject: [$RT::rtname #$test_ticket_id] test
@@ -256,14 +256,16 @@ END
     ok($links, "ticket has links");
     is($links->Count, 1, "one link");
 
-    my $link_type = $obj->LINKTYPEMAP->{ $field }->{'Type'};
-    my $link_mode = $obj->LINKTYPEMAP->{ $field }->{'Mode'};
+    my $typemap = keys %RT::Link::TYPEMAP ? \%RT::Link::TYPEMAP : $obj->LINKTYPEMAP;
+    my $link_type = $typemap->{ $field }->{'Type'};
+    my $link_mode = $typemap->{ $field }->{'Mode'};
 
     my $link = $links->First;
     is($link->Type, $link_type, "correct type");
     isa_ok($link, 'RT::Link');
     my $method = $link_mode .'Obj';
     is($link->$method()->Id, $link_ticket_id, 'set '. $field );
+    ok($obj->DeleteLink(Type => $field, Target => $link_ticket_id));
 }
 
 diag("set custom fields on update") if $ENV{'TEST_VERBOSE'};

-----------------------------------------------------------------------



More information about the Bps-public-commit mailing list