[Rt-commit] rt branch, 4.2/homepage-merge-defaults, created. rt-4.2.5-22-g0d0a348

Alex Vandiver alexmv at bestpractical.com
Fri Jun 13 16:42:57 EDT 2014


The branch, 4.2/homepage-merge-defaults has been created
        at  0d0a348048a2e2654df71c883fd7ee967ccbe7df (commit)

- Log -----------------------------------------------------------------
commit 0d0a348048a2e2654df71c883fd7ee967ccbe7df
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Fri Jun 13 16:37:49 2014 -0400

    Properly merge global defaults in to empty-hash homepages
    
    The "Reset to default" button on the "RT at a Glance" RT user admin page
    sets the preference to {}, not undef.  This worked prior to 9582e25a
    because ->Preferences( 'name', { thing => "Default" }) merges in the
    defaults into the hash, even if the hash exists.  This is different from
    the behavior that 9582e25a assumed, where the hash is a straight-up
    fallback which only kicks in if the value is undef.  This caused blank
    hompages for users whose preferences had been reset.
    
    Switch back to passing the global defaults to Preferences, which allows
    for per-key merging.
    
    Fixes I#30106.

diff --git a/share/html/Elements/MyRT b/share/html/Elements/MyRT
index 8a6d718..24fd73b 100644
--- a/share/html/Elements/MyRT
+++ b/share/html/Elements/MyRT
@@ -66,10 +66,11 @@
 my %allowed_components = map {$_ => 1} @{RT->Config->Get('HomepageComponents')};
 
 my $user = $session{'CurrentUser'}->UserObj;
-$Portlets ||= $user->Preferences('HomepageSettings');
 unless ( $Portlets ) {
     my ($defaults) = RT::System->new($session{'CurrentUser'})->Attributes->Named('HomepageSettings');
-    $Portlets = $defaults ? $defaults->Content : {};
+    $Portlets = $user->Preferences(
+        HomepageSettings => $defaults ? $defaults->Content : {}
+    );
 }
 
 $m->callback( CallbackName => 'MassagePortlets', Portlets => $Portlets );

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


More information about the rt-commit mailing list