Author: Amalthea.wikimedia
Description:
Hello
What I want to achieve is that the watchlist setting of a page is simply left unchanged by an edit through ApiEditPage. This is a requirement for maintainance tools like [[WP:Twinkle]] and [[WP:Huggle]], and the parameters "watch" and "unwatch" offered by ApiEditPage are not sufficient for this.
The current code in ApiEditPage.php is:
if($params['watch']) $watch = true; else if($params['unwatch']) $watch = false; else if($titleObj->userIsWatching()) $watch = true; else if($wgUser->getOption('watchdefault')) $watch = true; else if($wgUser->getOption('watchcreations') && !$titleObj->exists()) $watch = true; else $watch = false;
This code is acceptable if $wgUser->getOption('watchdefault') is turned off: I can set "watch" if the page should explicitly be watched, I can set "unwatch" if it should explicitly be unwatched. If I set nothing the watch status is unchanged.
If $wgUser->getOption('watchdefault') is true, many editors (like myself) do want to watchlist pages they edit manually, but not those edited through maintainance tools. However, with the above code, there is no way to leave the watch setting of a page as it is, short of getting the complete raw watchlist and setting "watch" or "unwatch" accordingly.
The best solution would be to offer a way that simply leaves the watchlist setting untouched. I can't see a clean solution short of introducing a third parameter for that, something like:
if($params['watch']) $watch = true; else if($params['unwatch']) $watch = false; else if ($params['watchunchanged']) $watch = $titleObj->userIsWatching(); else if($titleObj->userIsWatching()) $watch = true; else if($wgUser->getOption('watchdefault')) $watch = true; else if($wgUser->getOption('watchcreations') && !$titleObj->exists()) $watch = true; else $watch = false;
The next best thing might be to provide a way to get the watchlist setting through ApiQueryInfo, but that obviously will necessitate many extra queries.
Version: unspecified
Severity: enhancement