r64962 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r64961‎ | r64962 | r64963 >
Date:15:44, 12 April 2010
Author:mah
Status:ok (Comments)
Tags:
Comment:
re r64291 and r64852 use ApiBase::setWatch instead of wgUser->*Watch to set watches so that all api watch changes act the same.
Modified paths:
  • /trunk/phase3/includes/api/ApiMove.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiMove.php
@@ -121,26 +121,21 @@
122122 $this->getResult()->setIndexedTagName( $r['subpages-talk'], 'subpage' );
123123 }
124124 }
125 -
126 - // Watch pages
127 - $watch = $this->getWatchlistValue( $params['watchlist'], $fromTitle ) || $wgUser->getOption( 'watchmoves' );
128 -
129 - // Deprecated parameters
 125+
 126+ $watch = $params['watchlist'];
 127+ if ( $wgUser->getOption( 'watchmoves' ) ) {
 128+ $watch = 'watch';
 129+ }
130130 if ( $params['watch'] ) {
131 - $watch = true;
 131+ $watch = 'watch';
132132 } elseif ( $params['unwatch'] ) {
133 - $watch = false;
 133+ $watch = 'unwatch';
134134 }
135135
136 - if ( $watch !== null ) {
137 - if ( $watch ) {
138 - $wgUser->addWatch( $fromTitle );
139 - $wgUser->addWatch( $toTitle );
140 - } else {
141 - $wgUser->removeWatch( $fromTitle );
142 - $wgUser->removeWatch( $toTitle );
143 - }
144 - }
 136+ // Watch pages
 137+ $this->setWatch( $watch, $fromTitle );
 138+ $this->setWatch( $watch, $toTitle );
 139+
145140 $this->getResult()->addValue( null, $this->getModuleName(), $r );
146141 }
147142

Follow-up revisions

RevisionCommit summaryAuthorDate
r64975re r64962 clean up the logic for watchlist a littlemah20:15, 12 April 2010
r65017Followup to r64962: Fixed watchlist parameter in API. User options watchdelet...btongminh12:17, 14 April 2010

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r64291Followup r64197...reedy15:08, 28 March 2010
r64852* Clean up some duplicated code in r64291...mah06:11, 10 April 2010

Comments

#Comment by Reedy (talk | contribs)   15:52, 12 April 2010

Might aswell

if ( $params['watch'] || $wgUser->getOption( 'watchmoves' ) ) { $watch = 'watch'; }

#Comment by Bryan (talk | contribs)   17:52, 12 April 2010

Ideally all watch* user options follow watchlist=preferences. Currently ApiMove sets the watch unconditionally. I'm not sure yet about the best way to do this.

Status & tagging log