Index: trunk/phase3/includes/api/ApiEditPage.php |
— | — | @@ -169,18 +169,37 @@ |
170 | 170 | else |
171 | 171 | $reqArr['wpSection'] = ''; |
172 | 172 | |
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 | + { |
174 | 195 | $watch = true; |
175 | | - else if($params['unwatch']) |
| 196 | + $this->setWarning('The watch parameter has been deprecated.'); |
| 197 | + } |
| 198 | + elseif ($params['unwatch']) |
| 199 | + { |
176 | 200 | $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 | + |
185 | 204 | if($watch) |
186 | 205 | $reqArr['wpWatchthis'] = ''; |
187 | 206 | |
— | — | @@ -318,6 +337,15 @@ |
319 | 338 | 'captchaid' => null, |
320 | 339 | 'watch' => false, |
321 | 340 | '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 | + ), |
322 | 350 | 'md5' => null, |
323 | 351 | 'prependtext' => null, |
324 | 352 | 'appendtext' => null, |
— | — | @@ -349,8 +377,9 @@ |
350 | 378 | 'recreate' => 'Override any errors about the article having been deleted in the meantime', |
351 | 379 | 'createonly' => 'Don\'t edit the page if it exists already', |
352 | 380 | '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', |
355 | 384 | 'captchaid' => 'CAPTCHA ID from previous request', |
356 | 385 | 'captchaword' => 'Answer to the CAPTCHA', |
357 | 386 | '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 @@ |
297 | 297 | * (bug 19528) Added XSLT parameter to API queries in format=xml |
298 | 298 | * (bug 19040) Fix prependtext and appendtext in combination with section |
299 | 299 | parameter in action=edit |
| 300 | +* (bug 19090) Added watchlist parameter, deprecated watch and unwatch |
| 301 | + parameter in action=edit |
300 | 302 | |
301 | 303 | === Languages updated in 1.16 === |
302 | 304 | |