[Rt-commit] rt branch, 5.0/extra-query-params-in-page-menu, created. rt-5.0.0-22-g5d9a71f305
? sunnavy
sunnavy at bestpractical.com
Fri Sep 18 17:49:34 EDT 2020
The branch, 5.0/extra-query-params-in-page-menu has been created
at 5d9a71f3056a8495feb551c8a4a13baadb28e735 (commit)
- Log -----------------------------------------------------------------
commit 5d9a71f3056a8495feb551c8a4a13baadb28e735
Author: sunnavy <sunnavy at bestpractical.com>
Date: Sat Sep 19 04:06:29 2020 +0800
Keep ExtraQueryParams info in search page menu
Previously it was only kept on search builder page, which is not enough.
E.g. to search RTIR tickets, the build page URL is like:
/Search/Build.html?NewQuery=1&ExtraQueryParams=RTIR&RTIR=1
Add some non-RTIR criteria like "id < 10" and click "Add these terms and
Search", the search results page still contains ExtraQueryParams info in
URL. But if you then click page menu "Edit Search", the info is lost.
This commit retains ExtraQueryParams data in page menu for all search
pages.
diff --git a/lib/RT/Interface/Web/MenuBuilder.pm b/lib/RT/Interface/Web/MenuBuilder.pm
index 17eac59cb7..1652e2c39b 100644
--- a/lib/RT/Interface/Web/MenuBuilder.pm
+++ b/lib/RT/Interface/Web/MenuBuilder.pm
@@ -625,6 +625,13 @@ sub BuildMainNav {
$fallback_query_args{Class} ||= $class;
$fallback_query_args{ObjectType} ||= 'RT::Ticket' if $class eq 'RT::Transactions';
+ if ( my $extra_params = $HTML::Mason::Commands::DECODED_ARGS->{ExtraQueryParams} ) {
+ $fallback_query_args{ExtraQueryParams} = $extra_params;
+ for my $param ( ref $extra_params eq 'ARRAY' ? @$extra_params : $extra_params ) {
+ $fallback_query_args{$param} = $HTML::Mason::Commands::DECODED_ARGS->{$param};
+ }
+ }
+
if ($query_string) {
$args = '?' . $query_string;
}
@@ -632,13 +639,6 @@ sub BuildMainNav {
my %final_query_args = ();
# key => callback to avoid unnecessary work
- if ( my $extra_params = $query_args->{ExtraQueryParams} ) {
- $final_query_args{ExtraQueryParams} = $extra_params;
- for my $param ( ref $extra_params eq 'ARRAY' ? @$extra_params : $extra_params ) {
- $final_query_args{$param} = $query_args->{$param};
- }
- }
-
for my $param (keys %fallback_query_args) {
$final_query_args{$param} = defined($query_args->{$param})
? $query_args->{$param}
-----------------------------------------------------------------------
More information about the rt-commit
mailing list