Commit ca41f89a authored by Kevin Falcone's avatar Kevin Falcone
Browse files

Start returning early if we're acting on a non-RTIR ticket.

Otherwise, example.com or email addresses anywhere in the history of a
ticket in the General queue ends up with links off to
/RTIR/Tools/Lookup.html.  Normal users have no idea why those links are
there and they're frankly ugly and cluttering outside the RTIR workflow.
parent ec305bba
......@@ -64,6 +64,8 @@ my %actions;
default => sub {
my %args = @_;
$args{value} = $escaper->($args{value});
# don't execute on non-rtir tickets
return $args{value} unless defined $args{type};
return qq{<a href="$web_path/RTIR/Tools/Lookup.html?$args{lookup_params}q=$args{value}">$args{value}</a>};
},
url => sub {
......@@ -73,6 +75,9 @@ my %actions;
my $escaped_host = $escaper->($host);
my $super = $super{url} ? $super{url}->(%args) : $escaper->($args{value});
# don't execute on non-rtir tickets
return $super unless defined $args{type};
my $result = qq{[<a href="$web_path/RTIR/Tools/Lookup.html?$args{lookup_params}type=host&q=$escaped_host">}
.loc('lookup "[_1]"', $host) .qq{</a>]};
return $super . qq{ <span class="clickylink">$result</span>};
......@@ -84,12 +89,19 @@ my %actions;
my $escaped_host = $escaper->($host);
my $super = $super{url_overwrite} ? $super{url_overwrite}->(%args) : $escaper->($args{value});
# don't execute on non-rtir tickets
return $super unless defined $args{type};
my $result = qq{[<a href="$web_path/RTIR/Tools/Lookup.html?$args{lookup_params}type=host&q=$escaped_host">}
.loc('lookup "[_1]"', $host) .qq{</a>]};
return $super . qq{ <span class="clickylink">$result</span>};
},
ip => sub {
my %args = @_;
# don't execute on non-rtir tickets
return $escaper->($args{value}) unless defined $args{type};
$args{host} ||= $args{value};
my $escaped_host = $escaper->($args{host});
my $result .= qq{[<a href="$web_path/RTIR/Tools/Lookup.html?$args{lookup_params}type=ip&q=$escaped_host">}
......@@ -108,6 +120,10 @@ my %actions;
},
ipdecimal => sub {
my %args = @_;
# don't execute on non-rtir tickets
return $escaper->($args{value}) unless defined $args{type};
my $i = unpack "L",$args{value};
return $args{value} unless $args{value} > 33554432;
......@@ -123,6 +139,10 @@ my %actions;
},
email => sub {
my %args = @_;
# don't execute on non-rtir tickets
return $escaper->($args{value}) unless defined $args{type};
my $email = $args{'value'}; $email =~ s/^<|>$//g;
my $escaped_email = $escaper->($email);
......@@ -144,6 +164,10 @@ my %actions;
},
noc => sub {
my %args = @_;
# don't execute on non-rtir tickets
return $escaper->($args{value}) unless defined $args{type};
$args{value} = $escaper->($args{value});
my $result = qq{[<a href="$web_path/RTIR/Tools/Lookup.html?$args{lookup_params}type=handle&q=$args{value}">}
.loc('lookup') .qq{</a>]};
......@@ -151,6 +175,10 @@ my %actions;
},
host => sub {
my %args = @_;
# don't execute on non-rtir tickets
return $escaper->($args{value}) unless defined $args{type};
$args{value} = $escaper->($args{value});
my $result = qq{[<a href="$web_path/RTIR/Tools/Lookup.html?$args{lookup_params}type=host&q=$args{value}">}
.loc('lookup host') .qq{</a>]};
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment