[Rt-commit] rt branch 5.0/bulk-update-html-cfs created. rt-5.0.5-161-g8d490b81ae
BPS Git Server
git at git.bestpractical.com
Tue Feb 20 20:05:05 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/bulk-update-html-cfs has been created
at 8d490b81ae917025a28c6566f02ffc1adaa3a5ed (commit)
- Log -----------------------------------------------------------------
commit 8d490b81ae917025a28c6566f02ffc1adaa3a5ed
Author: sunnavy <sunnavy at bestpractical.com>
Date: Tue Feb 20 14:51:23 2024 -0500
Test HTML custom fields on bulk update page
diff --git a/t/web/search_bulk_update.t b/t/web/search_bulk_update.t
index f47c33e5ac..4afe88c141 100644
--- a/t/web/search_bulk_update.t
+++ b/t/web/search_bulk_update.t
@@ -163,4 +163,50 @@ $m->submit_form(
$m->text_like( qr{Ticket \d+: Status changed from 'new' to 'open'}, 'Bulk update messages' );
$m->text_unlike( qr{Ticket \d+: Ticket \d+:'}, 'Bulk update messages do not have duplicated prefix' );
+
+diag "Test HTML custom fields";
+{
+ my $cf = RT::Test->load_or_create_custom_field(
+ Name => 'HTML',
+ Type => 'HTML',
+ Description => 'HTML field',
+ MaxValues => 1,
+ Queue => 0,
+ );
+ my $cf_id = $cf->Id;
+
+ my $ticket = RT::Test->create_ticket(
+ Subject => "HTML ticket $_",
+ Queue => 'General',
+ );
+ my $ticket_id = $ticket->Id;
+
+ $m->get_ok( $url . "/Search/Bulk.html?Query=id=$ticket_id&Rows=10" );
+ $m->text_contains( 'HTML:', 'Has HTML field' );
+
+ $m->submit_form_ok( { form_name => 'BulkUpdate' }, 'Submit with no changes' );
+ $m->text_lacks( 'HTML text/html added', 'No changes of HTML CF fields', );
+
+ $m->submit_form_ok(
+ {
+ form_name => 'BulkUpdate',
+ fields => {
+ "Bulk-Add-CustomField-$cf_id-Values" => '<p>HTML text</p>'
+ }
+ },
+ 'Submit with HTML CF changes'
+ );
+ $m->text_contains( 'HTML <p>HTML text</p> added', 'Added HTML fields', );
+ $m->submit_form_ok(
+ {
+ form_name => 'BulkUpdate',
+ fields => {
+ "Bulk-Delete-CustomField-$cf_id-AllValues" => 1,
+ }
+ },
+ 'Submit with HTML CF deletion'
+ );
+ $m->text_contains( '<p>HTML text</p> is no longer a value for custom field HTML', 'Cleared HTML fields', );
+}
+
done_testing;
commit 4748631be9497077734958c07229cd9a211e3a4e
Author: sunnavy <sunnavy at bestpractical.com>
Date: Tue Feb 20 14:13:58 2024 -0500
Ignore HTML CF helper inputs(Bulk-Add-CustomField-...-ValuesType) on bulk update
We use Bulk-Add-CustomField-...-ValuesType inputs to indicate that the
corresponding Bulk-Add-CustomField-...-Values inputs are HTML instead of
plain text.
When the real HTML(CKEditor) input is empty on search bulk page, previously
the type value("text/html") was incorrectly added to tickets, this commit
fixes it.
diff --git a/lib/RT/Interface/Web.pm b/lib/RT/Interface/Web.pm
index e47fa96069..6fe866f97f 100644
--- a/lib/RT/Interface/Web.pm
+++ b/lib/RT/Interface/Web.pm
@@ -4169,7 +4169,8 @@ sub ProcessRecordBulkCustomFields {
foreach my $key ( keys %$ARGSRef ) {
next unless $key =~ /^Bulk-(Add|Delete)-CustomField-(\d+)-(.*)$/;
my ($op, $cfid, $rest) = ($1, $2, $3);
- next if $rest =~ /-Category$/;
+ # ValuesType is for HTML cfs
+ next if $rest =~ /(?:-Category|ValuesType)$/;
my $res = $data{$cfid} ||= {};
unless (keys %$res) {
-----------------------------------------------------------------------
hooks/post-receive
--
rt
More information about the rt-commit
mailing list