r53266 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r53265‎ | r53266 | r53267 >
Date:20:48, 14 July 2009
Author:btongminh
Status:ok
Tags:
Comment:
(bug 19090) Added watchlist parameter, deprecated watch and unwatch parameter in action=edit
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/api/ApiEditPage.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiEditPage.php
@@ -169,18 +169,37 @@
170170 else
171171 $reqArr['wpSection'] = '';
172172
173 - if($params['watch'])
 173+ // Handle watchlist settings
 174+ switch ($params['watchlist'])
 175+ {
 176+ case 'watch':
 177+ $watch = true;
 178+ break;
 179+ case 'unwatch':
 180+ $watch = false;
 181+ break;
 182+ case 'preferences':
 183+ if ($titleObj->exists())
 184+ $watch = $wgUser->getOption('watchdefault');
 185+ else
 186+ $watch = $wgUser->getOption('watchcreations');
 187+ break;
 188+ case 'nochange':
 189+ default:
 190+ $watch = $titleObj->userIsWatching();
 191+ }
 192+ // Deprecated parameters
 193+ if ($params['watch'])
 194+ {
174195 $watch = true;
175 - else if($params['unwatch'])
 196+ $this->setWarning('The watch parameter has been deprecated.');
 197+ }
 198+ elseif ($params['unwatch'])
 199+ {
176200 $watch = false;
177 - else if($titleObj->userIsWatching())
178 - $watch = true;
179 - else if($wgUser->getOption('watchdefault'))
180 - $watch = true;
181 - else if($wgUser->getOption('watchcreations') && !$titleObj->exists())
182 - $watch = true;
183 - else
184 - $watch = false;
 201+ $this->setWarning('The unwatch parameter has been deprecated.');
 202+ }
 203+
185204 if($watch)
186205 $reqArr['wpWatchthis'] = '';
187206
@@ -318,6 +337,15 @@
319338 'captchaid' => null,
320339 'watch' => false,
321340 'unwatch' => false,
 341+ 'watchlist' => array(
 342+ ApiBase :: PARAM_DFLT => 'preferences',
 343+ ApiBase :: PARAM_TYPE => array(
 344+ 'watch',
 345+ 'unwatch',
 346+ 'preferences',
 347+ 'nochange'
 348+ ),
 349+ ),
322350 'md5' => null,
323351 'prependtext' => null,
324352 'appendtext' => null,
@@ -349,8 +377,9 @@
350378 'recreate' => 'Override any errors about the article having been deleted in the meantime',
351379 'createonly' => 'Don\'t edit the page if it exists already',
352380 'nocreate' => 'Throw an error if the page doesn\'t exist',
353 - 'watch' => 'Add the page to your watchlist',
354 - 'unwatch' => 'Remove the page from your watchlist',
 381+ 'watch' => 'DEPRECATED! Add the page to your watchlist',
 382+ 'unwatch' => 'DEPRECATED! Remove the page from your watchlist',
 383+ 'watchlist' => 'Unconditionally add or remove the page from your watchlist, use preferences or do not change watch',
355384 'captchaid' => 'CAPTCHA ID from previous request',
356385 'captchaword' => 'Answer to the CAPTCHA',
357386 'md5' => array( 'The MD5 hash of the text parameter, or the prependtext and appendtext parameters concatenated.',
Index: trunk/phase3/RELEASE-NOTES
@@ -296,6 +296,8 @@
297297 * (bug 19528) Added XSLT parameter to API queries in format=xml
298298 * (bug 19040) Fix prependtext and appendtext in combination with section
299299 parameter in action=edit
 300+* (bug 19090) Added watchlist parameter, deprecated watch and unwatch
 301+ parameter in action=edit
300302
301303 === Languages updated in 1.16 ===
302304

Follow-up revisions

RevisionCommit summaryAuthorDate
r56940API: (bug 20816) Editing a page with &watchlist=preferences (default) unwatch...catrope09:22, 26 September 2009

Status & tagging log