[Rt-commit] rt branch 5.0/allow-empty-html-cf-on-create created. rt-5.0.2-258-g88a3b3715e

BPS Git Server git at git.bestpractical.com
Tue May 31 22:36:50 UTC 2022


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/allow-empty-html-cf-on-create has been created
        at  88a3b3715eb25d1d5ef128ca246406e605b2075e (commit)

- Log -----------------------------------------------------------------
commit 88a3b3715eb25d1d5ef128ca246406e605b2075e
Author: Brian Conry <bconry at bestpractical.com>
Date:   Tue May 31 17:17:07 2022 -0500

    Fix HTML custom fields getting 'text/html' as a value
    
    Commit c9d8c506ca added the HTML custom field type.  One of the
    mechanics for properly displaying and decoding the value for these
    fields is having a '-ValuesType' hidden input associated with the CF.
    
    The functions
    RT::Interface::Web::ProcessObjectCustomFieldUpdatesForCreate and
    RT::Transaction::UpdateCustomFields did not know to ignore this in the
    args list and were therefore processing it as if it were a '-Value'
    parameter, causing a CF that wasn't otherwise given a value to get the
    value 'text/html'.
    
    Other object types with custom fields use
    _ProcessObjectCustomFieldUpdates which did know to ignore the
    'ValuesType' parameter.

diff --git a/lib/RT/Interface/Web.pm b/lib/RT/Interface/Web.pm
index c58ba20758..3c6b3ac9b6 100644
--- a/lib/RT/Interface/Web.pm
+++ b/lib/RT/Interface/Web.pm
@@ -3516,7 +3516,8 @@ sub ProcessObjectCustomFieldUpdatesForCreate {
             while (my ($arg, $value) = each %{ $custom_fields{$class}{0}{$cfid}{$groupings[0]} }) {
                 # Values-Magic doesn't matter on create; no previous values are being removed
                 # Category is irrelevant for the actual value
-                next if $arg =~ /-Magic$/ or $arg =~ /-Category$/;
+                # ValuesType is only used for display
+                next if $arg =~ /-Magic$/ or $arg =~ /-Category$/ or $arg eq 'ValuesType';
 
                 push @values,
                     _NormalizeObjectCustomFieldValue(
diff --git a/lib/RT/Transaction.pm b/lib/RT/Transaction.pm
index e6a5746ce0..e072f996b6 100644
--- a/lib/RT/Transaction.pm
+++ b/lib/RT/Transaction.pm
@@ -1632,7 +1632,7 @@ sub UpdateCustomFields {
         next
           unless ( $arg =~
             /^(?:Object-RT::Transaction--)?CustomField-(\d+)/ );
-        next if $arg =~ /-Magic$/;
+        next if $arg =~ /-Magic$/ or $arg =~ /-Category$/ or $arg =~ /-ValuesType$/;
         my $cfid   = $1;
         my $values = $args{$arg};
         my $cf = $self->LoadCustomFieldByIdentifier($cfid);

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


hooks/post-receive
-- 
rt


More information about the rt-commit mailing list