Index: trunk/phase3/includes/api/ApiProtect.php |
— | — | @@ -118,7 +118,7 @@ |
119 | 119 | |
120 | 120 | if ( $params['watch'] || $watch ) { |
121 | 121 | $articleObj->doWatch(); |
122 | | - } else if ( !$watch ) { |
| 122 | + } else { |
123 | 123 | $articleObj->doUnwatch(); |
124 | 124 | } |
125 | 125 | |
Index: trunk/phase3/includes/api/ApiUndelete.php |
— | — | @@ -86,7 +86,7 @@ |
87 | 87 | |
88 | 88 | if ( $params['watch'] || $watch ) { |
89 | 89 | $wgUser->addWatch( $titleObj ); |
90 | | - } else if ( !$watch ) { |
| 90 | + } else { |
91 | 91 | $wgUser->removeWatch( $titleObj ); |
92 | 92 | } |
93 | 93 | |
Index: trunk/phase3/includes/api/ApiBase.php |
— | — | @@ -538,24 +538,20 @@ |
539 | 539 | protected function getWatchlistValue ( $watchlist, $titleObj ) { |
540 | 540 | switch ( $watchlist ) { |
541 | 541 | case 'watch': |
542 | | - $watch = true; |
543 | | - break; |
| 542 | + return true; |
544 | 543 | case 'unwatch': |
545 | | - $watch = false; |
546 | | - break; |
547 | | - case 'preferences': |
548 | | - global $wgUser; |
549 | | - |
| 544 | + return false; |
| 545 | + case 'preferences': |
550 | 546 | if ( $titleObj->exists() ) { |
551 | | - $watch = $wgUser->getOption( 'watchdefault' ) || $titleObj->userIsWatching(); |
| 547 | + global $wgUser; |
| 548 | + |
| 549 | + return ($wgUser->getOption( 'watchdefault' ) || $titleObj->userIsWatching()); |
552 | 550 | } |
553 | | - break; |
| 551 | + return false; |
554 | 552 | case 'nochange': |
555 | 553 | default: |
556 | | - $watch = $titleObj->userIsWatching(); |
| 554 | + return $titleObj->userIsWatching(); |
557 | 555 | } |
558 | | - |
559 | | - return $watch; |
560 | 556 | } |
561 | 557 | |
562 | 558 | /** |