FU r89545: change broke api watching by switching watch and unwatch around.
authorNiklas Laxström <nikerabbit@users.mediawiki.org>
Tue, 14 Jun 2011 13:10:26 +0000 (13:10 +0000)
committerNiklas Laxström <nikerabbit@users.mediawiki.org>
Tue, 14 Jun 2011 13:10:26 +0000 (13:10 +0000)
Also added zero to the article constructor..how many subtle bugs we need to make default article constructor sane?

includes/api/ApiWatch.php

index 8e76eeb..241e25d 100644 (file)
@@ -53,17 +53,17 @@ class ApiWatch extends ApiBase {
                        $this->dieUsageMsg( array( 'invalidtitle', $params['title'] ) );
                }
 
-               $article = new Article( $title );
+               $article = new Article( $title, 0 );
                $res = array( 'title' => $title->getPrefixedText() );
 
                if ( $params['unwatch'] ) {
                        $res['unwatched'] = '';
                        $res['message'] = wfMsgExt( 'removedwatchtext', array( 'parse' ), $title->getPrefixedText() );
-                       $success = WatchAction::doWatch( $title, $wgUser );
+                       $success = WatchAction::doUnwatch( $title, $wgUser );
                } else {
                        $res['watched'] = '';
                        $res['message'] = wfMsgExt( 'addedwatchtext', array( 'parse' ), $title->getPrefixedText() );
-                       $success = UnwatchAction::doUnwatch( $title, $wgUser );
+                       $success = UnwatchAction::doWatch( $title, $wgUser );
                }
                if ( !$success ) {
                        $this->dieUsageMsg( 'hookaborted' );