Index: trunk/phase3/includes/api/ApiBase.php |
— | — | @@ -578,9 +578,12 @@ |
579 | 579 | * @param $titleObj Title the page under consideration |
580 | 580 | * @param $userOption String The user option to consider when $watchlist=preferences. |
581 | 581 | * If not set will magically default to either watchdefault or watchcreations |
582 | | - * @returns mixed |
| 582 | + * @returns Boolean |
583 | 583 | */ |
584 | 584 | protected function getWatchlistValue ( $watchlist, $titleObj, $userOption = null ) { |
| 585 | + |
| 586 | + $userWatching = $titleObj->userIsWatching(); |
| 587 | + |
585 | 588 | global $wgUser; |
586 | 589 | switch ( $watchlist ) { |
587 | 590 | case 'watch': |
— | — | @@ -591,22 +594,22 @@ |
592 | 595 | |
593 | 596 | case 'preferences': |
594 | 597 | # If the user is already watching, don't bother checking |
595 | | - if ( $titleObj->userIsWatching() ) { |
596 | | - return null; |
| 598 | + if ( $userWatching ) { |
| 599 | + return true; |
597 | 600 | } |
598 | 601 | # If no user option was passed, use watchdefault or watchcreation |
599 | 602 | if ( is_null( $userOption ) ) { |
600 | 603 | $userOption = $titleObj->exists() |
601 | 604 | ? 'watchdefault' : 'watchcreations'; |
602 | 605 | } |
603 | | - # If the corresponding user option is true, watch, else no change |
604 | | - return $wgUser->getOption( $userOption ) ? true : null; |
| 606 | + # If the corresponding user option is true, watch, don't |
| 607 | + return $wgUser->getOption( $userOption ) ? true : false; |
605 | 608 | |
606 | 609 | case 'nochange': |
607 | | - return null; |
| 610 | + return $userWatching; |
608 | 611 | |
609 | 612 | default: |
610 | | - return null; |
| 613 | + return $userWatching; |
611 | 614 | } |
612 | 615 | } |
613 | 616 | |