[Rt-commit] rt branch 5.0/txn-search-remove-duplicate-type-criteria created. rt-5.0.5-46-g863714d30a
BPS Git Server
git at git.bestpractical.com
Thu Nov 16 21:35:17 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/txn-search-remove-duplicate-type-criteria has been created
at 863714d30a8e80ccc7f262da9cade5c484059141 (commit)
- Log -----------------------------------------------------------------
commit 863714d30a8e80ccc7f262da9cade5c484059141
Author: sunnavy <sunnavy at bestpractical.com>
Date: Thu Nov 16 16:19:23 2023 -0500
Make sure both prefix and suffix of spaces are removed
Previously after parsing and reassembling, searches like "... AND ( id >
0 )" were changed to "... AND ( id > 0 )", note that an additional
whitespace was added ahead of "id > 0". This commit fixes this issue.
diff --git a/lib/RT/Interface/Web/QueryBuilder/Tree.pm b/lib/RT/Interface/Web/QueryBuilder/Tree.pm
index 59365881da..2b1f8cb5c1 100644
--- a/lib/RT/Interface/Web/QueryBuilder/Tree.pm
+++ b/lib/RT/Interface/Web/QueryBuilder/Tree.pm
@@ -297,7 +297,8 @@ sub __LinearizeTree {
$str .= $key ." ". $op . " " . $value;
}
- $str =~ s/^\s+|\s+$//;
+ $str =~ s/^\s+//;
+ $str =~ s/\s+$//;
push @$list, {
NODE => $node,
commit 2be1b0fe108f40407209f1dda7bfbb4475b8265d
Author: sunnavy <sunnavy at bestpractical.com>
Date: Thu Nov 16 15:43:23 2023 -0500
Avoid duplicates of TicketType/ObjectType criteria for txn searches
The duplicates could happen when you navigate pages on txn search result
page.
diff --git a/lib/RT/Interface/Web.pm b/lib/RT/Interface/Web.pm
index 7718e61918..260a646d46 100644
--- a/lib/RT/Interface/Web.pm
+++ b/lib/RT/Interface/Web.pm
@@ -5806,11 +5806,16 @@ sub PreprocessTransactionSearchQuery {
my @limits;
if ( $args{ObjectType} eq 'RT::Ticket' ) {
- @limits = (
- q{TicketType = 'ticket'},
- qq{ObjectType = '$args{ObjectType}'},
- $args{Query} =~ /^\s*\(.*\)$/ ? $args{Query} : "($args{Query})"
- );
+ if ( $args{Query} !~ /^TicketType = 'ticket' AND ObjectType = '$args{ObjectType}' AND (.+)/ ) {
+ @limits = (
+ q{TicketType = 'ticket'},
+ qq{ObjectType = '$args{ObjectType}'},
+ $args{Query} =~ /^\s*\(.*\)$/ ? $args{Query} : "($args{Query})"
+ );
+ }
+ else {
+ @limits = $args{Query};
+ }
}
else {
# Other ObjectTypes are not supported for now
diff --git a/t/web/search_txns.t b/t/web/search_txns.t
index bf4ca0b817..24366e1911 100644
--- a/t/web/search_txns.t
+++ b/t/web/search_txns.t
@@ -29,9 +29,14 @@ diag "Query builder";
$m->follow_link_ok( { id => 'page-results' } );
$m->title_is('Found 3 transactions');
+ $m->get_ok($m->uri . '&RowsPerPage=1');
+ $m->follow_link_ok( { text => '2' } );
+ $m->follow_link_ok( { text => '3' } );
+
+ $m->follow_link_ok( { text => 'Edit Search' }, 'Build Query' );
+ my $form = $m->form_name('BuildQuery');
+ is($form->find_input('Query')->value, qq{TicketType = 'ticket' AND ObjectType = 'RT::Ticket' AND ( TicketId = 1 )});
- $m->back;
- $m->form_name('BuildQuery');
$m->field( TypeOp => '=' );
$m->field( ValueOfType => 'Create' );
$m->click('AddClause');
-----------------------------------------------------------------------
hooks/post-receive
--
rt
More information about the rt-commit
mailing list