[Rt-commit] rt branch 5.0/fix-tickets-autocomplete-on-create created. rt-5.0.5-202-g0fad97a714

BPS Git Server git at git.bestpractical.com
Thu Apr 4 01:47:55 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-create has been created
        at  0fad97a7140f28053204598012665e584c456346 (commit)

- Log -----------------------------------------------------------------
commit 0fad97a7140f28053204598012665e584c456346
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Wed Apr 3 17:35:50 2024 -0400

    Re-enable links autocomplete on create pages
    
    Previously we accidentally disabled links autocomplete on create pages when
    adding the "excluding existing links" feature in c0888d6165. The main reason
    is %exclude_links contained not just exclude ids but also autocomplete
    flags. As it was set only when exclude ids were not empty, it broke create
    pages.
    
    This commit separates default autocomplete flags from %exclude_links and
    explicitly add it to all link inputs to make the logic more clear.

diff --git a/share/html/Elements/AddLinks b/share/html/Elements/AddLinks
index 32cbf9c8fe..ac8cde57e3 100644
--- a/share/html/Elements/AddLinks
+++ b/share/html/Elements/AddLinks
@@ -55,7 +55,7 @@ my $id = ($Object and $Object->id)
     ? $Object->id
     : "new";
 
-my $exclude = qq| data-autocomplete="LinkTargets" data-autocomplete-multiple="1"|;
+my $autocomplete = qq|data-autocomplete="LinkTargets" data-autocomplete-multiple="1"|;
 my @excludes;
 push @excludes, ( $Object->isa('RT::Asset') ? 'asset:' : '' ) . $id
     if $id ne 'new';
@@ -98,7 +98,7 @@ foreach my $exclude_type ( keys %exclude_links ) {
             }
         }
     }
-    $exclude_links{$exclude_type} = $exclude . ' data-autocomplete-exclude="' . join( ' ', @excludes, @ids ) . '"'
+    $exclude_links{$exclude_type} = 'data-autocomplete-exclude="' . join( ' ', @excludes, @ids ) . '"'
         if @excludes || @ids;
 }
 </%init>
@@ -120,24 +120,24 @@ foreach my $exclude_type ( keys %exclude_links ) {
 
 
 <&| /Elements/LabeledValue, RawLabel => $m->scomp('ShowRelationLabel', Object => $Object, Label => loc('Depends on'), Relation => 'DependsOn') &>
-  <input type="text" class="form-control" name="<%$id%>-DependsOn" value="<% $ARGSRef->{"$id-DependsOn"} || '' %>" <% $exclude_links{Depend} |n%>/>
+  <input type="text" class="form-control" name="<%$id%>-DependsOn" value="<% $ARGSRef->{"$id-DependsOn"} || '' %>" <% $autocomplete |n %>  <% $exclude_links{Depend} |n%>/>
 </&>
 <&| /Elements/LabeledValue, RawLabel => $m->scomp('ShowRelationLabel', Object => $Object, Label => loc('Depended on by'), Relation => 'DependedOnBy') &>
-  <input type="text" class="form-control" name="DependsOn-<%$id%>" value="<% $ARGSRef->{"DependsOn-$id"} || '' %>" <% $exclude_links{Depend} |n%>/>
+  <input type="text" class="form-control" name="DependsOn-<%$id%>" value="<% $ARGSRef->{"DependsOn-$id"} || '' %>" <% $autocomplete |n %>  <% $exclude_links{Depend} |n%>/>
 </&>
 
 <&| /Elements/LabeledValue, RawLabel => $m->scomp('ShowRelationLabel', Object => $Object, Label => loc('Parents'), Relation => 'Parents') &>
-  <input type="text" class="form-control" name="<%$id%>-MemberOf" value="<% $ARGSRef->{"$id-MemberOf"} || '' %>" <% $exclude_links{Member} |n%>/>
+  <input type="text" class="form-control" name="<%$id%>-MemberOf" value="<% $ARGSRef->{"$id-MemberOf"} || '' %>" <% $autocomplete |n %>  <% $exclude_links{Member} |n%>/>
 </&>
 <&| /Elements/LabeledValue, RawLabel => $m->scomp('ShowRelationLabel', Object => $Object, Label => loc('Children'), Relation => 'Children') &>
-  <input type="text" class="form-control" name="MemberOf-<%$id%>" value="<% $ARGSRef->{"MemberOf-$id"} || '' %>" <% $exclude_links{Member} |n%>/>
+  <input type="text" class="form-control" name="MemberOf-<%$id%>" value="<% $ARGSRef->{"MemberOf-$id"} || '' %>" <% $autocomplete |n %>  <% $exclude_links{Member} |n%>/>
 </&>
 
 <&| /Elements/LabeledValue, RawLabel => $m->scomp('ShowRelationLabel', Object => $Object, Label => loc('Refers to'), Relation => 'RefersTo') &>
-  <input type="text" class="form-control" name="<%$id%>-RefersTo" value="<% $ARGSRef->{"$id-RefersTo"} || '' %>" <% $exclude_links{Refer} |n%>/>
+  <input type="text" class="form-control" name="<%$id%>-RefersTo" value="<% $ARGSRef->{"$id-RefersTo"} || '' %>" <% $autocomplete |n %> <% $exclude_links{Refer} |n%>/>
 </&>
 <&| /Elements/LabeledValue, RawLabel => $m->scomp('ShowRelationLabel', Object => $Object, Label => loc('Referred to by'), Relation => 'ReferredToBy') &>
-  <input type="text" class="form-control" name="RefersTo-<%$id%>" value="<% $ARGSRef->{"RefersTo-$id"} || '' %>" <% $exclude_links{Refer} |n%>/>
+  <input type="text" class="form-control" name="RefersTo-<%$id%>" value="<% $ARGSRef->{"RefersTo-$id"} || '' %>" <% $autocomplete |n %> <% $exclude_links{Refer} |n%>/>
 </&>
 
   <& /Elements/EditCustomFields,

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


hooks/post-receive
-- 
rt


More information about the rt-commit mailing list