[Rt-commit] rt branch, 4.0-trunk, updated. rt-4.0.24-34-g7bdd183

Alex Vandiver alexmv at bestpractical.com
Fri Aug 5 13:14:03 EDT 2016


The branch, 4.0-trunk has been updated
       via  7bdd183b11be1b24d137115454d6de55818de42e (commit)
      from  877b88b07f34e39ac0d0c82a938a31faff4edc7a (commit)

Summary of changes:
 share/html/Elements/MyRT | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

- Log -----------------------------------------------------------------
commit 7bdd183b11be1b24d137115454d6de55818de42e
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.
    
    (cherry picked from commit 0d0a348048a2e2654df71c883fd7ee967ccbe7df)

diff --git a/share/html/Elements/MyRT b/share/html/Elements/MyRT
index 1f80b8f..9b616e7 100644
--- a/share/html/Elements/MyRT
+++ b/share/html/Elements/MyRT
@@ -67,10 +67,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