Check if SpecialMobileWatchlist exist

If MobileFrontend doesn't exist this will throw an error

Bug: T171241
Change-Id: Ie61cfa61b78a53598ac59aea15c8a4e6a261238d
This commit is contained in:
jdlrobson 2017-08-17 16:59:12 -05:00 committed by Jdlrobson
parent f08b6defd7
commit d5e09c91e9
1 changed files with 10 additions and 7 deletions

View File

@ -470,13 +470,16 @@ class SkinMinerva extends SkinTemplate implements ICustomizableSkin {
$watchlistQuery = [];
$user = $this->getUser();
if ( $user ) {
$view = $user->getOption( SpecialMobileWatchlist::VIEW_OPTION_NAME, false );
$filter = $user->getOption( SpecialMobileWatchlist::FILTER_OPTION_NAME, false );
if ( $view ) {
$watchlistQuery['watchlistview'] = $view;
}
if ( $filter && $view === 'feed' ) {
$watchlistQuery['filter'] = $filter;
// Avoid fatal when MobileFrontend not available (T171241)
if ( class_exists( 'SpecialMobileWatchlist' ) ) {
$view = $user->getOption( SpecialMobileWatchlist::VIEW_OPTION_NAME, false );
$filter = $user->getOption( SpecialMobileWatchlist::FILTER_OPTION_NAME, false );
if ( $view ) {
$watchlistQuery['watchlistview'] = $view;
}
if ( $filter && $view === 'feed' ) {
$watchlistQuery['filter'] = $filter;
}
}
}