[Rt-commit] rt branch, 4.2/per-user-dashboards-in-menu, updated. rt-3.9.7-1232-gb695551

Shawn Moore sartak at bestpractical.com
Thu Mar 3 19:35:10 EST 2011


The branch, 4.2/per-user-dashboards-in-menu has been updated
       via  b695551cdd46949761f04f70ce48f0ef527c0500 (commit)
      from  ba9337ba9bce3ca0a59c447945cc3a4a9516efde (commit)

Summary of changes:
 share/html/Elements/Tabs |   25 ++++++++++++++++++-------
 1 files changed, 18 insertions(+), 7 deletions(-)

- Log -----------------------------------------------------------------
commit b695551cdd46949761f04f70ce48f0ef527c0500
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Thu Mar 3 19:34:12 2011 -0500

    Refactor the store in session and pull from global config logic
    
        We were consulting the session but not using it for caching, no
        reason not to do the caching.
    
        Also there's no reason to consult the global dashboard config if the
        user has a local override, so refactor that logic too.

diff --git a/share/html/Elements/Tabs b/share/html/Elements/Tabs
index 1ccc23e..00d8952 100755
--- a/share/html/Elements/Tabs
+++ b/share/html/Elements/Tabs
@@ -61,13 +61,24 @@ my $query_string = sub {
 my $build_main_nav = sub {
 
     my $home = Menu->child( home => title => loc('Homepage'), path => '/' );
-    my ($default_dashboards) =
-      RT::System->new( $session{'CurrentUser'} )
-      ->Attributes->Named('DashboardsInMenu');
-    my $dashboard_pref =
-      $session{CurrentUser}->UserObj->Preferences( 'DashboardsInMenu',
-        $default_dashboards ? $default_dashboards->Content : () );
-    $session{'dashboards_in_menu'} ||= $dashboard_pref->{dashboards} || [];
+
+    unless ($session{'dashboards_in_menu'}) {
+        my $dashboards_in_menu = $session{CurrentUser}->UserObj->Preferences(
+            'DashboardsInMenu',
+        );
+
+        if (!$dashboards_in_menu) {
+            my ($default_dashboards) =
+                RT::System->new( $session{'CurrentUser'} )
+                    ->Attributes
+                    ->Named('DashboardsInMenu');
+            if ($default_dashboards) {
+                $dashboards_in_menu = $default_dashboards->Content;
+            }
+        }
+
+        $session{'dashboards_in_menu'} = $dashboards_in_menu->{dashboards} || [];
+    }
     
     my @dashboards;
     for my $id ( @{$session{'dashboards_in_menu'}} ) {

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


More information about the Rt-commit mailing list