[Rt-commit] rt branch, 4.2/cf-autocomplete-grouping-name, created. rt-4.2.1rc1-4-gc712200

Jim Brandt jbrandt at bestpractical.com
Fri Nov 15 13:22:49 EST 2013


The branch, 4.2/cf-autocomplete-grouping-name has been created
        at  c712200de45e1fce9b5014643a12030da606c8b3 (commit)

- Log -----------------------------------------------------------------
commit ee1274a0b5f2825bec4ba5c7fa2c737f4c8a67c0
Author: Jim Brandt <jbrandt at bestpractical.com>
Date:   Fri Nov 15 10:56:51 2013 -0500

    Update NamePrefix regex to match CF grouping when provided
    
    8d87f2ce added a grouping string to the NamePrefix. Update
    the autocomplete helper to handle it. Use
    _ParseObjectCustomFieldArgs to avoid duplicating the regex.

diff --git a/share/html/Helpers/Autocomplete/CustomFieldValues b/share/html/Helpers/Autocomplete/CustomFieldValues
index a5ba1fc..505d24b 100644
--- a/share/html/Helpers/Autocomplete/CustomFieldValues
+++ b/share/html/Helpers/Autocomplete/CustomFieldValues
@@ -63,11 +63,17 @@ unless ( exists $ARGS{ContextType} and exists $ARGS{ContextId} ) {
     $abort->();
 }
 
+# Use _ParseObjectCustomFieldArgs to avoid duplicating the regex.
+# See the docs for _ParseObjectCustomFieldArgs for details on the data
+# structure returned. There will be only one CF, so drill down 2 layers
+# to get the cf id, if one is there.
+
+my %custom_fields = _ParseObjectCustomFieldArgs(\%ARGS);
 my $CustomField;
-for my $k ( keys %ARGS ) {
-    next unless $k =~ /^Object-.*?-\d*-CustomField-(\d+)-Values?$/;
-    $CustomField = $1;
-    last;
+foreach my $class ( keys %custom_fields ){
+    foreach my $id ( keys %{$custom_fields{$class}} ){
+        ($CustomField) = keys %{$custom_fields{$class}{$id}};
+    }
 }
 
 unless ( $CustomField ) {

commit c712200de45e1fce9b5014643a12030da606c8b3
Author: Jim Brandt <jbrandt at bestpractical.com>
Date:   Fri Nov 15 11:54:54 2013 -0500

    Update autocomplete calls to include object type
    
    The previous autocomplete queries were successful with the old
    autocomplete cf regex, but object type (i.e., RT::Ticket) is
    correctly required in the CF arg string by the regex in
    _ParseObjectCustomFieldArgs.

diff --git a/t/security/CVE-2011-2084-cf-values.t b/t/security/CVE-2011-2084-cf-values.t
index 1178b15..21c8547 100644
--- a/t/security/CVE-2011-2084-cf-values.t
+++ b/t/security/CVE-2011-2084-cf-values.t
@@ -41,7 +41,7 @@ sub ac {
         $args{ContextType} = ref($obj) unless defined $args{ContextType};
     }
 
-    $args{"Object---CustomField-$args{CF}-Values"} = "";
+    $args{"Object-RT::Ticket--CustomField-$args{CF}-Values"} = "";
     delete $args{CF};
 
     delete $args{$_} for grep {not defined $args{$_}} keys %args;
diff --git a/t/web/case-sensitivity.t b/t/web/case-sensitivity.t
index 5220bbd..7599371 100644
--- a/t/web/case-sensitivity.t
+++ b/t/web/case-sensitivity.t
@@ -73,7 +73,7 @@ my $cf;
 
 # test custom field values auto completer
 {
-    $m->get_ok('/Helpers/Autocomplete/CustomFieldValues?term=eNo&Object---CustomField-'. $cf->id .'-Value&ContextId=1&ContextType=RT::Queue');
+    $m->get_ok('/Helpers/Autocomplete/CustomFieldValues?term=eNo&Object-RT::Ticket--CustomField-'. $cf->id .'-Value&ContextId=1&ContextType=RT::Queue');
     require JSON;
     is_deeply(
         JSON::from_json( $m->content ),

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


More information about the rt-commit mailing list