From 8fee24ec11f01c5a6b524548639798869a26771d Mon Sep 17 00:00:00 2001 From: sunnavy Date: Wed, 4 Dec 2024 16:52:09 -0500 Subject: [PATCH] Show a hint message in dashboard emails if charts are not available --- share/html/Search/Elements/Chart | 4 ++++ t/mail/dashboard-chart-with-utf8.t | 2 ++ 2 files changed, 6 insertions(+) diff --git a/share/html/Search/Elements/Chart b/share/html/Search/Elements/Chart index 850a000d36..5475677e76 100644 --- a/share/html/Search/Elements/Chart +++ b/share/html/Search/Elements/Chart @@ -84,7 +84,11 @@ RT::Interface::Web::Session::Set(
% if ( ($ChartStyle || '') =~ /\b(pie|bar|line)\b/ ) {
+% if ( !$r->isa('RT::Dashboard::FakeRequest') || RT->Config->Get('EmailDashboardIncludeCharts') ) { <& /Search/JSChart, Cache => $key, %ARGS, GroupBy => \@GroupBy &> +% } else { + <&|/l&>Chart is not available in emails, click title to get the live version. +% }
% }
diff --git a/t/mail/dashboard-chart-with-utf8.t b/t/mail/dashboard-chart-with-utf8.t index 29553b2e36..bf7faecf23 100644 --- a/t/mail/dashboard-chart-with-utf8.t +++ b/t/mail/dashboard-chart-with-utf8.t @@ -96,4 +96,6 @@ like( 'mail subject' ); +like( $mail->bodyhandle->as_string, qr/Chart is not available in emails, click title to get the live version/, 'chart hint' ); + done_testing;