Mailing List Archive

rt branch 5.0/shortener-page-links created. rt-5.0.5-108-g5fcf7e6d58
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/shortener-page-links has been created
at 5fcf7e6d588f915c5f29a7177ccb0aadcdfbf36a (commit)

- Log -----------------------------------------------------------------
commit 5fcf7e6d588f915c5f29a7177ccb0aadcdfbf36a
Author: sunnavy <sunnavy@bestpractical.com>
Date: Thu Jan 4 09:19:47 2024 -0500

Support shortener for page links

diff --git a/share/html/Elements/CollectionListPaging b/share/html/Elements/CollectionListPaging
index 812856db69..1e193926ff 100644
--- a/share/html/Elements/CollectionListPaging
+++ b/share/html/Elements/CollectionListPaging
@@ -75,6 +75,7 @@ else{
$pager->current_page($CurrentPage);

my @pages = BuildSearchResultPagination( $pager );
+ %$URLParams = ShortenSearchQuery(%$URLParams);

foreach my $page ( @pages ) {

diff --git a/t/web/search_shortener.t b/t/web/search_shortener.t
index 0be2740f94..c6774b6b75 100644
--- a/t/web/search_shortener.t
+++ b/t/web/search_shortener.t
@@ -10,14 +10,14 @@ RT::Test->create_ticket(
Queue => 'General',
Subject => 'Shortener test',
Content => 'test',
-);
+) for 1 .. 15;

ok $m->login, 'logged in';

$m->follow_link_ok( { text => 'New Search' } );
$m->submit_form_ok(
{ form_name => 'BuildQuery',
- fields => { ValueOfid => 10 },
+ fields => { ValueOfid => 20, RowsPerPage => 10 },
button => 'DoSearch',
}
);
@@ -42,7 +42,7 @@ for my $menu (@menus) {

$m->follow_link_ok( { text => 'Advanced', url_regex => qr{/Search/Edit\.html\?sc=\w+} } );
$m->form_name('BuildQueryAdvanced');
-is( $m->value('Query'), 'id < 10', 'Query on Advanced' );
+is( $m->value('Query'), 'id < 20', 'Query on Advanced' );

$m->follow_link_ok( { text => 'Show Results', url_regex => qr{/Search/Results\.html\?sc=\w+} } );
$m->content_contains('Shortener test', 'Found the ticket');
@@ -59,10 +59,12 @@ for my $feed (@feeds) {
last;
}

+$m->follow_link_ok( { text => 2, url_regex => qr{/Search/Results\.html\?Page=2&sc=\w+} } );
+
$m->follow_link_ok( { text => 'Shredder', url_regex => qr/\bsc=\w+/ } );
$m->form_id('shredder-search-form');
-is( $m->value('Tickets:query'), 'id < 10', 'Tickets:query in shredder' );
-is( $m->value('Tickets:limit'), 50, 'Tickets:limit in shredder' );
+is( $m->value('Tickets:query'), 'id < 20', 'Tickets:query in shredder' );
+is( $m->value('Tickets:limit'), 10, 'Tickets:limit in shredder' );


$m->get_ok('/Search/Build.html?Query=Queue="General"');

commit 2d3b0c71432a3a7dc52912c250d042938a5417dc
Author: sunnavy <sunnavy@bestpractical.com>
Date: Thu Jan 4 09:16:27 2024 -0500

Make sure BaseQuery is unset if it is equal to Query

diff --git a/lib/RT/Interface/Web.pm b/lib/RT/Interface/Web.pm
index 7838f3e0a5..b727dbb606 100644
--- a/lib/RT/Interface/Web.pm
+++ b/lib/RT/Interface/Web.pm
@@ -5537,7 +5537,10 @@ sub ShortenSearchQuery {

my %short_args;
my %supported = map { $_ => 1 } @SHORTENER_SEARCH_FIELDS, @SHORTENER_CHART_FIELDS;
- for my $field ( keys %supported ) {
+
+ # Sort to make sure BaseQuery is always processed before Query: we compare
+ # them in the loop and unset BaseQuery if it's equal to Query.
+ for my $field ( sort keys %supported ) {
my $value;
if ( exists $query_args{$field} ) {
$value = delete $query_args{$field};

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


hooks/post-receive
--
rt
_______________________________________________
rt-commit mailing list
rt-commit@lists.bestpractical.com
https://lists.bestpractical.com/mailman/listinfo/rt-commit