diff options
author | sunnavy <sunnavy@bestpractical.com> | 2022-09-28 09:21:42 +0300 |
---|---|---|
committer | sunnavy <sunnavy@bestpractical.com> | 2022-09-28 12:40:06 +0300 |
commit | 3a995e6f704bbcf4d9050b01c6e216fc0aa6453f (patch) | |
tree | a529a2c6ef5c01534dd0b0891a7ccbf1e7c7913c | |
parent | 712515e60e874f7f9b34affb909461d702582d04 (diff) |
Force to use light theme for dashboard emails5.0/dashboard-email-force-light-theme
Light theme has better compatibility with email clients. Considering
clients usually have their own dark theme applied, it's not necessary to
explicitly apply dark theme to emails.
This is initially to fix an issue for Outlook desktop clients: as it
only supports background-color for partial tags, dark theme emails were
rendered weirdly when config $EmailDashboardInlineCSS(implemented in
5.0/dashboard-inline-css) is enabled.
-rw-r--r-- | lib/RT/Dashboard/Mailer.pm | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/RT/Dashboard/Mailer.pm b/lib/RT/Dashboard/Mailer.pm index 84275ecfa3..e46d83e121 100644 --- a/lib/RT/Dashboard/Mailer.pm +++ b/lib/RT/Dashboard/Mailer.pm @@ -100,6 +100,17 @@ sub MailDashboards { $Users->Limit( FIELD => 'id', VALUE => $user->Id || 0 ); } + # Force to use light theme for better compatibility with email clients + my $original_config_get = \&RT::Config::Get; + no warnings 'redefine'; + local *RT::Config::Get = sub { + my ( $self, $name ) = @_; + if ( $name eq 'WebDefaultStylesheet' ) { + return 'elevator-light'; + } + return $original_config_get->(@_); + }; + while (defined(my $user = $Users->Next)) { my ($hour, $dow, $dom) = HourDowDomIn($args{Time}, $user->Timezone || RT->Config->Get('Timezone')); $hour .= ':00'; |