Mailing List Archive

rt branch 5.0/dashboard-email-force-light-theme created. rt-5.0.3-346-g541605aca2
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 541605aca220d0e6f88bcabf4314eef5f5e51380 (commit)

- Log -----------------------------------------------------------------
commit 541605aca220d0e6f88bcabf4314eef5f5e51380
Author: sunnavy <sunnavy@bestpractical.com>
Date: Thu Mar 30 04:30:11 2023 +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 is enabled.

diff --git a/lib/RT/Dashboard/Mailer.pm b/lib/RT/Dashboard/Mailer.pm
index 39743d4b08..1812616963 100644
--- a/lib/RT/Dashboard/Mailer.pm
+++ b/lib/RT/Dashboard/Mailer.pm
@@ -396,6 +396,7 @@ SUMMARY

local $HTML::Mason::Commands::session{CurrentUser} = $currentuser;
local $HTML::Mason::Commands::session{ContextUser} = $context_user;
+ local $HTML::Mason::Commands::session{WebDefaultStylesheet} = 'elevator-light';
local $HTML::Mason::Commands::r = RT::Dashboard::FakeRequest->new;

my $HasResults = undef;
diff --git a/lib/RT/Interface/Web.pm b/lib/RT/Interface/Web.pm
index da815d01b2..3b4d5e99b6 100644
--- a/lib/RT/Interface/Web.pm
+++ b/lib/RT/Interface/Web.pm
@@ -5378,6 +5378,7 @@ sub GetStylesheet {
CurrentUser => $session{CurrentUser},
@_,
);
+ return $session{WebDefaultStylesheet} if $session{WebDefaultStylesheet};
return $args{'CurrentUser'} ? $args{'CurrentUser'}->Stylesheet : RT->Config->Get('WebDefaultStylesheet');
}


commit c0b0652b14d048cd75e9567df3f88b4943a3c2b8
Author: sunnavy <sunnavy@bestpractical.com>
Date: Thu Mar 30 04:26:51 2023 +0800

Abstract GetStylesheet for web

With it, we'll be able to easily override stylesheet.

diff --git a/lib/RT/Interface/Web.pm b/lib/RT/Interface/Web.pm
index 17dfc131e2..da815d01b2 100644
--- a/lib/RT/Interface/Web.pm
+++ b/lib/RT/Interface/Web.pm
@@ -5367,6 +5367,20 @@ sub BuildSearchResultPagination {
return @pages;
}

+=head2 GetStylesheet CurrentUser => CURRENT_USER
+
+Return config L<RT_Config/$WebDefaultStylesheet> for specified user.
+
+=cut
+
+sub GetStylesheet {
+ my %args = (
+ CurrentUser => $session{CurrentUser},
+ @_,
+ );
+ return $args{'CurrentUser'} ? $args{'CurrentUser'}->Stylesheet : RT->Config->Get('WebDefaultStylesheet');
+}
+
package RT::Interface::Web;
RT::Base->_ImportOverlays();

diff --git a/share/html/Elements/Header b/share/html/Elements/Header
index b4ba6b78e1..4e37fac9db 100644
--- a/share/html/Elements/Header
+++ b/share/html/Elements/Header
@@ -99,7 +99,7 @@
% $m->callback( CallbackName => 'EndOfHead', ARGSRef => \%ARGS );

</head>
- <body class="<% join( ' ',@{$ARGS{'BodyClass'}}, RT->Config->Get('WebDefaultStylesheet', $session{CurrentUser}) =~ /-dark$/ ? 'darkmode' : ()) %>" <% $id && qq[id="comp-$id"] |n %>>
+ <body class="<% join( ' ',@{$ARGS{'BodyClass'}}, GetStylesheet() =~ /-dark$/ ? 'darkmode' : ()) %>" <% $id && qq[id="comp-$id"] |n %>>
<div class="main-container">
% # The close div for this is in PageLayout right before the rt body div
% if ( $ShowBar || $ShowTitle ) {
@@ -134,10 +134,7 @@ $id =~ s|index$||g
if $id ne 'index';
$id =~ s|-$||g;

-my $style = $session{'CurrentUser'}
- ? $session{'CurrentUser'}->Stylesheet
- : RT->Config->Get('WebDefaultStylesheet');
-
+my $style = GetStylesheet();
my @css_files;
if ( RT->Config->Get('DevelMode') ) {
@css_files = map { "/static/css/$_" } "$style/main.css", RT->Config->Get('CSSFiles');
diff --git a/share/html/Elements/PageLayout b/share/html/Elements/PageLayout
index 22203705aa..a3bde709d4 100644
--- a/share/html/Elements/PageLayout
+++ b/share/html/Elements/PageLayout
@@ -68,9 +68,8 @@ $title => $m->callers(-1)->path
$show_menu => 1
</%ARGS>
<%init>
-my $style = $session{'CurrentUser'}
- ? $session{'CurrentUser'}->Stylesheet
- : RT->Config->Get('WebDefaultStylesheet');
+my $style = GetStylesheet();
+
my $beforenav_plugin = "/NoAuth/css/".$style."/BeforeNav";
my $aftermenu_plugin = "/NoAuth/css/".$style."/AfterMenus";
</%init>

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


hooks/post-receive
--
rt
_______________________________________________
rt-commit mailing list
rt-commit@lists.bestpractical.com
https://lists.bestpractical.com/mailman/listinfo/rt-commit