[Rt-commit] [rtir] 01/01: MakeClicky may now be called on non-tickets 775f4bd

Kevin Falcone falcone at bestpractical.com
Tue Apr 22 16:49:03 EDT 2014


This is an automated email from the git hooks/post-receive script.

falcone pushed a commit to branch 3.2/test-fixes
in repository rtir.

commit d58c1bad8c15db8d1843de0a92ae1efcc8f822c0
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Tue Apr 22 15:56:26 2014 -0400

    MakeClicky may now be called on non-tickets 775f4bd
    
    This means we get an object argument rather than ticket and should guard
    against non-tickets, since asking for Queues and doing RTIR magic is
    probably unhelpful.
    
    Diffing without whitespace changes (or using word diff) will help with
    this change.
---
 html/Callbacks/RTIR/Elements/MakeClicky/Default | 26 +++++++++++++------------
 1 file changed, 14 insertions(+), 12 deletions(-)

diff --git a/html/Callbacks/RTIR/Elements/MakeClicky/Default b/html/Callbacks/RTIR/Elements/MakeClicky/Default
index 2364c8e..2837cf7 100644
--- a/html/Callbacks/RTIR/Elements/MakeClicky/Default
+++ b/html/Callbacks/RTIR/Elements/MakeClicky/Default
@@ -109,9 +109,9 @@ my %actions;
         if ( $args{incident} && !RT->Config->Get('RTIR_DisableBlocksQueue') ) {
             $result .= qq{[<a href="$web_path/RTIR/Create.html?Incident=$args{incident}&Queue=Blocks&IP-Value=$escaped_host">block</a>]};
         }
-        if ( $args{'ticket'} && $args{'ticket'}->id ) {
+        if ( $args{'object'} && $args{'object'}->id ) {
             my $cf = RT::IR::GetCustomField('IP');
-            my $tid = $args{'ticket'}->id;
+            my $tid = $args{'object'}->id;
             $result .= qq{[<a href="$web_path/RTIR/Edit.html?id=$tid}
                 .qq{&Object-RT::Ticket-$tid-CustomField-}. $cf->id .qq{-AddValue=$escaped_host}
                 .q{&SaveChanges=1">}. loc('Add IP') .q{</a>]};
@@ -220,20 +220,22 @@ my $handle = ${$ARGS{handle}};
 ${$ARGS{handle}} = sub {
     my %args = @_;
 
-    if ( $args{ticket} ) {
-        $args{type} = RT::IR::TicketType( Queue => $args{ticket}->QueueObj->Name );
+    if ($args{object}->isa('RT::Ticket')) {
+        if ( $args{object} ) {
+            $args{type} = RT::IR::TicketType( Queue => $args{object}->QueueObj->Name );
 
-        $args{incident} = $args{ticket}->id
-          if $args{type} && $args{type} eq 'Incident';
+            $args{incident} = $args{ticket}->id
+              if $args{type} && $args{type} eq 'Incident';
 
-        $args{lookup_params} = "ticket=".$args{ticket}->id
-            if !$args{lookup_params};
-    }
+            $args{lookup_params} = "ticket=".$args{object}->id
+                if !$args{lookup_params};
+        }
 
-    $args{lookup_params} .= "&"
-      if $args{lookup_params} and $args{lookup_params} !~ /&$/;
+        $args{lookup_params} .= "&"
+          if $args{lookup_params} and $args{lookup_params} !~ /&$/;
 
-    $args{lookup_params} = $escaper->($args{lookup_params});
+        $args{lookup_params} = $escaper->($args{lookup_params});
+    }
 
     return $handle->(%args);
 };

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the rt-commit mailing list