[Rt-commit] rt branch, 5.0/subject-tag-unicode-fix, created. rt-5.0.1-460-g870cdb8f73
Craig Kaiser
craig at bestpractical.com
Wed Jun 16 09:46:14 EDT 2021
The branch, 5.0/subject-tag-unicode-fix has been created
at 870cdb8f7353dac20a5634e1ac780ef794c96582 (commit)
- Log -----------------------------------------------------------------
commit f153415db6cbd7b1ac3cc0256bcbe2af959bd675
Author: craig kaiser <craig at bestpractical.com>
Date: Wed Jun 16 08:45:37 2021 -0400
Add test for subject tag with unicode characters
diff --git a/t/mail/extractsubjecttag.t b/t/mail/extractsubjecttag.t
index 1aadaa7b7d..6a8b60a209 100644
--- a/t/mail/extractsubjecttag.t
+++ b/t/mail/extractsubjecttag.t
@@ -1,7 +1,8 @@
use strict;
use warnings;
+use utf8;
-use RT::Test tests => 18;
+use RT::Test tests => undef;
my $queue = RT::Test->load_or_create_queue(
Name => 'Regression',
@@ -103,3 +104,25 @@ EOF
unlike($freshticket->Subject,qr/\[\Q$subject_tag\E #$ticketid\]/,'Stripped Queue Subject Tag correctly');
}
+
+$queue = RT::Test->load_or_create_queue(
+ Name => 'Unicode Character Subject Tag Queue',
+ CorrespondAddress => 'rt-recipient at example.com',
+ CommentAddress => 'rt-recipient at example.com',
+);
+$subject_tag = 'Demande générale';
+ok $queue && $queue->id, 'loaded or created queue';
+
+diag "Test System Subject Tag Matches Queue Object Subject Tag";
+{
+ is(RT->System->SubjectTag($queue), undef, 'No Subject Tag yet');
+ my ($status, $msg) = $queue->SetSubjectTag( $subject_tag );
+ ok $status, "set subject tag for the queue" or diag "error: $msg";
+
+ my @subject_tags = sort RT->System->SubjectTag();
+
+ is($subject_tags[0], $subject_tag, "Set Subject Tag to $subject_tag");
+}
+
+done_testing();
+
commit 870cdb8f7353dac20a5634e1ac780ef794c96582
Author: craig kaiser <craig at bestpractical.com>
Date: Wed Jun 16 08:45:46 2021 -0400
Ensure values returned from DistinctFieldValues are utf8
diff --git a/lib/RT/SearchBuilder.pm b/lib/RT/SearchBuilder.pm
index d070b2ad1f..0b31b82d42 100644
--- a/lib/RT/SearchBuilder.pm
+++ b/lib/RT/SearchBuilder.pm
@@ -1070,6 +1070,33 @@ sub NotSetDateToNullFunction {
return $res;
}
+sub DistinctFieldValues {
+ my $self = shift;
+ my %args = (
+ Field => undef,
+ Order => undef,
+ Max => undef,
+ decode_utf8 => 1,
+ @_%2 ? (Field => @_) : (@_)
+ );
+
+ my @values = $self->SUPER::DistinctFieldValues( %args );
+
+ foreach my $value ( @values ) {
+ if ( $args{'decode_utf8'} ) {
+ if ( !utf8::is_utf8( $value ) ) { # mysql/sqlite
+ utf8::decode( $value );
+ }
+ }
+ else {
+ if ( utf8::is_utf8( $value ) ) {
+ utf8::encode( $value );
+ }
+ }
+ }
+ return @values;
+}
+
RT::Base->_ImportOverlays();
1;
-----------------------------------------------------------------------
More information about the rt-commit
mailing list