]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Update PersonalGroupNav with fixed highlighting checks.
authorBrion Vibber <brion@pobox.com>
Fri, 11 Mar 2011 22:25:57 +0000 (14:25 -0800)
committerBrion Vibber <brion@pobox.com>
Fri, 11 Mar 2011 22:25:57 +0000 (14:25 -0800)
Couldn't use Menu::item() as its checks are only for the action name, so would have highlighted stuff for other users though it always links to self.

lib/personalgroupnav.php

index 3d6bb98fc02d7c00109d06fda0385a58675f399f..2e15ca5f6a02d3c9eec40802f97dd6759d8ac435 100644 (file)
@@ -63,6 +63,9 @@ class PersonalGroupNav extends Menu
         $nickname     = $user->nickname;
         $name         = $user_profile->getBestName();
 
+        $action = $this->actionName;
+        $mine = ($this->action->arg('nickname') == $nickname); // @fixme kinda vague
+
         $this->out->elementStart('ul', array('class' => 'nav'));
 
         if (Event::handle('StartPersonalGroupNav', array($this))) {
@@ -70,23 +73,23 @@ class PersonalGroupNav extends Menu
                                                                $nickname)),
                                  _('Home'),
                                  sprintf(_('%s and friends'), $name),
-                                 $this->action == 'all', 'nav_timeline_personal');
+                                 $mine && $action =='all', 'nav_timeline_personal');
             $this->out->menuItem(common_local_url('showstream', array('nickname' =>
                                                                       $nickname)),
                                  _('Profile'),
                                  _('Your profile'),
-                                 $this->action == 'showstream',
+                                 $mine && $action =='showstream',
                                  'nav_profile');
             $this->out->menuItem(common_local_url('replies', array('nickname' =>
                                                                    $nickname)),
                                  _('Replies'),
                                  sprintf(_('Replies to %s'), $name),
-                                 $this->action == 'replies', 'nav_timeline_replies');
+                                 $mine && $action =='replies', 'nav_timeline_replies');
             $this->out->menuItem(common_local_url('showfavorites', array('nickname' =>
                                                                          $nickname)),
                                  _('Favorites'),
                                  sprintf(_('%s\'s favorite notices'), ($user_profile) ? $name : _('User')),
-                                 $this->action == 'showfavorites', 'nav_timeline_favorites');
+                                 $mine && $action =='showfavorites', 'nav_timeline_favorites');
 
             $cur = common_current_user();
 
@@ -97,7 +100,7 @@ class PersonalGroupNav extends Menu
                                                                      $nickname)),
                                      _('Messages'),
                                      _('Your incoming messages'),
-                                     $this->action == 'inbox');
+                                     $mine && $action =='inbox');
             }
 
             Event::handle('EndPersonalGroupNav', array($this));