* @param $titleObj Title the page under consideration
* @param $userOption String The user option to consider when $watchlist=preferences.
* If not set will magically default to either watchdefault or watchcreations
- * @returns mixed
+ * @returns Boolean
*/
protected function getWatchlistValue ( $watchlist, $titleObj, $userOption = null ) {
+
+ $userWatching = $titleObj->userIsWatching();
+
global $wgUser;
switch ( $watchlist ) {
case 'watch':
case 'preferences':
# If the user is already watching, don't bother checking
- if ( $titleObj->userIsWatching() ) {
- return null;
+ if ( $userWatching ) {
+ return true;
}
# If no user option was passed, use watchdefault or watchcreation
if ( is_null( $userOption ) ) {
$userOption = $titleObj->exists()
? 'watchdefault' : 'watchcreations';
}
- # If the corresponding user option is true, watch, else no change
- return $wgUser->getOption( $userOption ) ? true : null;
+ # If the corresponding user option is true, watch, don't
+ return $wgUser->getOption( $userOption ) ? true : false;
case 'nochange':
- return null;
+ return $userWatching;
default:
- return null;
+ return $userWatching;
}
}