https://bugzilla.wikimedia.org/show_bug.cgi?id=19090

       Web browser: ---
           Summary: Watchlist settings of ApiEditPage are inyufficient
           Product: MediaWiki
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: Normal
         Component: API
        AssignedTo: roan.katt...@gmail.com
        ReportedBy: amalthea.wikime...@googlemail.com
                CC: bryan.tongm...@gmail.com, vasi...@gmail.com,
                    soxre...@gmail.com


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.


-- 
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

_______________________________________________
Wikibugs-l mailing list
Wikibugs-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to