[Rt-commit] rt branch, 4.2/autocomplete-ticket, created. rt-4.2.3-58-g418113c

Alex Vandiver alexmv at bestpractical.com
Thu Mar 20 20:15:38 EDT 2014


The branch, 4.2/autocomplete-ticket has been created
        at  418113cfa06b76cdc69abb515ba8d920faa78eed (commit)

- Log -----------------------------------------------------------------
commit 1107ac4101f89d61e1c44883b8bfb35df5401f54
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Thu Mar 20 20:12:19 2014 -0400

    Move esacping closer to where it is relevant

diff --git a/share/html/Helpers/Autocomplete/Tickets b/share/html/Helpers/Autocomplete/Tickets
index fc0478b..4b17e0e 100644
--- a/share/html/Helpers/Autocomplete/Tickets
+++ b/share/html/Helpers/Autocomplete/Tickets
@@ -68,8 +68,6 @@ my $CurrentUser = $session{'CurrentUser'};
 # Require privileged users
 $m->abort unless $CurrentUser->Privileged;
 
-$term =~ s/(['\\])/\\$1/g;
-
 my @excludes;
 
 if ( $term =~ /[^\d\s]/ ) { # to search subject, which may contain spaces
@@ -89,6 +87,7 @@ my %fields = %{ RT->Config->Get('TicketAutocompleteFields')
 my $tickets = RT::Tickets->new( $CurrentUser );
 
 my @clauses;
+$term =~ s/(['\\])/\\$1/g;  #'
 while (my ($name, $op) = each %fields) {
     $op = 'STARTSWITH'
         unless $op =~ /^(?:LIKE|(?:START|END)SWITH|=|!=)$/i;

commit f7b21cb50f6e75b60d9269659fa43ff8f435f591
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Thu Mar 20 20:12:55 2014 -0400

    Stop caring about word boundaries during ticket autocompletion
    
    Rather than use \b to help split on what to search for, use a greedy
    regex that matches as many space-separated ticket numbers as possible.
    This solves problems with autocompleting "4.2.0", for instance.
    
    Resolves issues #25755.

diff --git a/share/html/Helpers/Autocomplete/Tickets b/share/html/Helpers/Autocomplete/Tickets
index 4b17e0e..e0af4f1 100644
--- a/share/html/Helpers/Autocomplete/Tickets
+++ b/share/html/Helpers/Autocomplete/Tickets
@@ -70,16 +70,9 @@ $m->abort unless $CurrentUser->Privileged;
 
 my @excludes;
 
-if ( $term =~ /[^\d\s]/ ) { # to search subject, which may contain spaces
-    (my $prev, $term) = $term =~ /(.*?)\s*\b([^\d\s].*)/;
-    @excludes = split /\s+/, $prev if $prev;
-}
-else {
-    my @terms = split /\s+/, $term;
-    $term = pop @terms;
-    @excludes = @terms;
-}
-push @excludes, split /\s+/, $exclude if $exclude;
+(my $prev, $term) = $term =~ /^((?:\d+\s+)*)(.*)/;
+ at excludes = split ' ', $prev if $prev;
+push @excludes, split ' ', $exclude if $exclude;
 
 my %fields = %{ RT->Config->Get('TicketAutocompleteFields')
                 || { id => 'STARTSWITH', Subject => 'LIKE' } };

commit 418113cfa06b76cdc69abb515ba8d920faa78eed
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Thu Mar 20 20:15:18 2014 -0400

    Abort if there is nothing to search for
    
    It is now possible for $term to be empty -- for instance, when
    autocompleting "1 2 3 ".  In such cases, don't search at all, merely
    abort.

diff --git a/share/html/Helpers/Autocomplete/Tickets b/share/html/Helpers/Autocomplete/Tickets
index e0af4f1..83d4b9e 100644
--- a/share/html/Helpers/Autocomplete/Tickets
+++ b/share/html/Helpers/Autocomplete/Tickets
@@ -74,6 +74,8 @@ my @excludes;
 @excludes = split ' ', $prev if $prev;
 push @excludes, split ' ', $exclude if $exclude;
 
+$m->abort unless $term;
+
 my %fields = %{ RT->Config->Get('TicketAutocompleteFields')
                 || { id => 'STARTSWITH', Subject => 'LIKE' } };
 

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


More information about the rt-commit mailing list