Skip to content

Commit

Permalink
Support components not in /Elements/ for requests from /Views/Component/
Browse files Browse the repository at this point in the history
There are cases that homepage components are in other directories like
/RTIR/Elements/.
  • Loading branch information
sunnavy committed Jan 21, 2025
1 parent 7947ca4 commit e23385c
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions share/html/Views/Component/dhandler
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,16 @@
<%init>
my ($component_name) = $m->dhandler_arg;

my $path;
if ( $component_name ne 'SavedSearch' ) {
my $path = "/Elements/$component_name";
unless ( $m->comp_exists($path) ) {
RT->Logger->warning("Component $component_name does not exist");
if ( $m->comp_exists("/$component_name") ) {
$path = "/$component_name";
}
elsif ( $m->comp_exists("/Elements/$component_name") ) {
$path = "/Elements/$component_name";
}
else {
RT->Logger->warning( "Component $component_name does not exist" );
Abort( loc('Invalid Path'), SuppressHeader => 1 );
}

Expand Down Expand Up @@ -98,7 +104,7 @@ if ( $component_name eq 'SavedSearch' ) {
eval { $out = $m->scomp( "/Elements/ShowSearch", %ARGS ) };
}
else {
eval { $out = $m->scomp( "/Elements/$component_name", %ARGS ) };
eval { $out = $m->scomp( $path, %ARGS ) };
}

if ($@) {
Expand Down

0 comments on commit e23385c

Please sign in to comment.