[Rt-commit] rt branch 5.0/fix-tickets-autocomplete-on-select created. rt-5.0.5-163-ge489e342b4

BPS Git Server git at git.bestpractical.com
Tue Feb 27 21:51:07 UTC 2024


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/fix-tickets-autocomplete-on-select has been created
        at  e489e342b4d95a5eb847746179582ab1c7b1daab (commit)

- Log -----------------------------------------------------------------
commit e489e342b4d95a5eb847746179582ab1c7b1daab
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Tue Feb 27 16:32:15 2024 -0500

    Fix the regex that identifies if the item is search term for autocomplete
    
    All digital items that may or may not have type prefixes(like "asset:") are
    existing values, the rest are search terms.
    
    When we switched to LinkTargets autocomplete in 6d0b00e669, we updated the
    regex to handle non-ticket link types like "asset", "articles", etc. The
    regex wasn't correct as it treated "foo" in "foo bar" as an existing value,
    thus if you selected the ticket from dropdown, the input would be like "foo
    123" instead of "123".

diff --git a/share/static/js/autocomplete.js b/share/static/js/autocomplete.js
index fd41ab592d..1010625196 100644
--- a/share/static/js/autocomplete.js
+++ b/share/static/js/autocomplete.js
@@ -167,7 +167,7 @@ window.RT.Autocomplete.bind = function(from) {
                     // remove non-integers in case subject search with spaces in (like "foo bar")
                     var new_terms = [];
                     for ( var i = 0; i < terms.length; i++ ) {
-                        if ( terms[i].match(/^(?:(asset|a|group|user):)\D/) ) {
+                        if ( !terms[i].match(/^(?:(asset|a|group|user):)?\d+$/) ) {
                             break; // Items after the first non-integers are all parts of search string
                         }
                         new_terms.push(terms[i]);

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


hooks/post-receive
-- 
rt


More information about the rt-commit mailing list