[Rt-commit] rt branch 5.0/fix-user-stylesheet created. rt-5.0.4-37-g1bf6ac2c1e

BPS Git Server git at git.bestpractical.com
Thu Jun 29 21:53:48 UTC 2023


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/fix-user-stylesheet has been created
        at  1bf6ac2c1ec104b67f17a4e6570c09ee4af6dd2b (commit)

- Log -----------------------------------------------------------------
commit 1bf6ac2c1ec104b67f17a4e6570c09ee4af6dd2b
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Fri Jun 30 05:36:02 2023 +0800

    Test RT::User::Stylesheet

diff --git a/t/api/user.t b/t/api/user.t
index 0b1c76025a..d10a7217da 100644
--- a/t/api/user.t
+++ b/t/api/user.t
@@ -412,4 +412,13 @@ diag 'Test LoadOrCreateByEmail';
     is ($load_user4->EmailAddress, 'load-create-test-3 at example.com', 'Email set to load-create-test-3 at example.com');
 }
 
+diag 'Test Stylesheet';
+{
+    my $user = RT::Test->load_or_create_user( Name => 'root' );
+    is( $user->Stylesheet, 'elevator-light', 'Default stylesheet' );
+    my ( $status, $msg ) = $user->SetPreferences( RT->System, { WebDefaultStylesheet => 'elevator-dark' } );
+    ok( $status, $msg );
+    is( $user->Stylesheet, 'elevator-dark', 'Updated stylesheet' );
+}
+
 done_testing();

commit eb2dbc2f9ef6735e0f3c933379b5abd222038a96
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Fri Jun 30 05:15:28 2023 +0800

    Get the Stylesheet of the called user object instead of its CurrentUser
    
    It's apparently wrong that $user->Stylesheet returns the
    "WebDefaultStylesheet" pref of the user's CurrentUser object.
    
    Previously it wasn't an issue as we call Stylesheet only on an
    RT::CurrentUser object, of which CurrentUser method returned itself. It
    wasn't true any more as we changed RT::CurrentUser::CurrentUser to
    return a new object in b7b820d316 to avoid circular refs.
    
    This commit fixes a web UI issue that updating "Theme" on user Prefs
    page didn't take effect immediately, because of outdated cached
    attributes of the object returned by RT::CurrentUser::CurrentUser.

diff --git a/lib/RT/User.pm b/lib/RT/User.pm
index 2d32f2d563..b1a8cb911b 100644
--- a/lib/RT/User.pm
+++ b/lib/RT/User.pm
@@ -1753,7 +1753,7 @@ Returns a list of valid stylesheets take from preferences.
 sub Stylesheet {
     my $self = shift;
 
-    my $style = RT->Config->Get('WebDefaultStylesheet', $self->CurrentUser);
+    my $style = RT->Config->Get('WebDefaultStylesheet', $self);
 
     if (RT::Interface::Web->ComponentPathIsSafe($style)) {
         for my $root (RT::Interface::Web->StaticRoots) {

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


hooks/post-receive
-- 
rt


More information about the rt-commit mailing list