Hygiene: Document that insertWatchlistMenuItem doesnt work for anons

Follow up to Ic729992db4db459044a239ec34d95e56b013841d
Change-Id: I1de8f8f527fb5f84d7f080eb5d81298bae3b48b3
This commit is contained in:
jdlrobson 2018-04-19 17:39:35 -07:00
parent 892adf0ea7
commit c4b28af2c3
1 changed files with 4 additions and 4 deletions

View File

@ -488,16 +488,16 @@ class SkinMinerva extends SkinTemplate implements ICustomizableSkin {
} }
/** /**
* Inserts the Watchlist menu item into the menu. * Inserts the Watchlist menu item into the menu for a logged in user
* *
* @param MenuBuilder $menu * @param MenuBuilder $menu
* @param User $user that must be logged in
*/ */
protected function insertWatchlistMenuItem( MenuBuilder $menu ) { protected function insertWatchlistMenuItem( MenuBuilder $menu, User $user ) {
$watchTitle = SpecialPage::getTitleFor( 'Watchlist' ); $watchTitle = SpecialPage::getTitleFor( 'Watchlist' );
// Watchlist link // Watchlist link
$watchlistQuery = []; $watchlistQuery = [];
$user = $this->getUser();
// Avoid fatal when MobileFrontend not available (T171241) // Avoid fatal when MobileFrontend not available (T171241)
if ( class_exists( 'SpecialMobileWatchlist' ) ) { if ( class_exists( 'SpecialMobileWatchlist' ) ) {
$view = $user->getOption( SpecialMobileWatchlist::VIEW_OPTION_NAME, false ); $view = $user->getOption( SpecialMobileWatchlist::VIEW_OPTION_NAME, false );
@ -574,7 +574,7 @@ class SkinMinerva extends SkinTemplate implements ICustomizableSkin {
$user = $this->getUser(); $user = $this->getUser();
if ( $user->isLoggedIn() ) { if ( $user->isLoggedIn() ) {
$this->insertWatchlistMenuItem( $menu ); $this->insertWatchlistMenuItem( $menu, $user );
$this->insertContributionsMenuItem( $menu, $user ); $this->insertContributionsMenuItem( $menu, $user );
} }
} }