[Rt-commit] rt branch 5.0/new-transactions-search-page-menu-fix created. rt-5.0.4-72-g5f4d386cc9

BPS Git Server git at git.bestpractical.com
Fri Jul 21 21:33:46 UTC 2023


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "rt".

The branch, 5.0/new-transactions-search-page-menu-fix has been created
        at  5f4d386cc9709cde8f55a329c1de6516ea42d5d2 (commit)

- Log -----------------------------------------------------------------
commit 5f4d386cc9709cde8f55a329c1de6516ea42d5d2
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Sat Jul 22 00:28:17 2023 +0300

    append $args to "Edit Search" even if we has no query
    
    $has_query indicates if we have `Query != ''` or not.
    
    This condition may be worked when we only had search by tickets, but
    these days we have Class, ObjectType and other arguments that should
    be preserved between search pages even when we have no query.

diff --git a/lib/RT/Interface/Web/MenuBuilder.pm b/lib/RT/Interface/Web/MenuBuilder.pm
index 5a5bea1df1..1e32c24ddd 100644
--- a/lib/RT/Interface/Web/MenuBuilder.pm
+++ b/lib/RT/Interface/Web/MenuBuilder.pm
@@ -725,7 +725,7 @@ sub BuildMainNav {
         }
 
         $current_search_menu->child( edit_search =>
-            title => loc('Edit Search'), sort_order => 1, path => "/Search/Build.html" . ( ($has_query) ? $args : '' ) );
+            title => loc('Edit Search'), sort_order => 1, path => "/Search/Build.html$args" );
         if ( $current_user->HasRight( Right => 'ShowSearchAdvanced', Object => RT->System ) ) {
             $current_search_menu->child( advanced => title => loc('Advanced'), path => "/Search/Edit.html$args" );
         }

commit 3c030875d2ae8926c65a8b7cbbd7847b9950d37f
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Sat Jul 22 00:25:52 2023 +0300

    don't generate $args that is equal to '?'
    
    we concatenate the variable with paths without checking and
    we want to avoid hanging '?' at the end of links

diff --git a/lib/RT/Interface/Web/MenuBuilder.pm b/lib/RT/Interface/Web/MenuBuilder.pm
index b1bf7ad01a..5a5bea1df1 100644
--- a/lib/RT/Interface/Web/MenuBuilder.pm
+++ b/lib/RT/Interface/Web/MenuBuilder.pm
@@ -667,7 +667,7 @@ sub BuildMainNav {
         }
 
         my %short_query = ShortenSearchQuery(%final_query_args);
-        $args = '?' . QueryString(%short_query);
+        $args = '?' . QueryString(%short_query) if keys %short_query;
 
         my $current_search_menu;
         if (   $class eq 'RT::Tickets' && $request_path =~ m{^/Ticket}

commit bb0877ffae07f9ebc4ed82153831953c54e73d7d
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Sat Jul 22 00:20:59 2023 +0300

    remove unused local variable that is very misleading
    
    Spent some time wondering why we work wih an empty hash
    like it has data. Only to find that we declare `%query_args`
    and never use it, but use `$query_args` that is declared in
    the very beginning of the sub.

diff --git a/lib/RT/Interface/Web/MenuBuilder.pm b/lib/RT/Interface/Web/MenuBuilder.pm
index 696d21b9af..b1bf7ad01a 100644
--- a/lib/RT/Interface/Web/MenuBuilder.pm
+++ b/lib/RT/Interface/Web/MenuBuilder.pm
@@ -603,7 +603,6 @@ sub BuildMainNav {
 
         $has_query = 1 if ( $HTML::Mason::Commands::DECODED_ARGS->{'Query'} or $current_search->{'Query'} );
 
-        my %query_args;
         my %fallback_query_args = (
             SavedSearchId => ( $search_id eq 'new' || $search_id eq $chart_id ) ? undef : $search_id,
             SavedChartSearchId => $chart_id,
@@ -871,7 +870,6 @@ sub BuildMainNav {
         my $has_query;
         $has_query = 1 if ( $HTML::Mason::Commands::DECODED_ARGS->{'Query'} or $current_search->{'Query'} );
 
-        my %query_args;
         my %fallback_query_args = (
             Class => 'RT::Assets',
             SavedSearchId => ( $search_id eq 'new' ) ? undef : $search_id,

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


hooks/post-receive
-- 
rt


More information about the rt-commit mailing list