[Rt-commit] rt branch 5.0/dashboard-email-force-light-theme created. rt-5.0.3-123-g3a995e6f70

BPS Git Server git at git.bestpractical.com
Wed Sep 28 09:44:09 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/dashboard-email-force-light-theme has been created
        at  3a995e6f704bbcf4d9050b01c6e216fc0aa6453f (commit)

- Log -----------------------------------------------------------------
commit 3a995e6f704bbcf4d9050b01c6e216fc0aa6453f
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Wed Sep 28 14:21:42 2022 +0800

    Force to use light theme for dashboard emails
    
    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.

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';

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


hooks/post-receive
-- 
rt


More information about the rt-commit mailing list