If one tries to unwatch a page *not* via the AJAX star, but by direct link to e.g. /w/index.php?title=Foo&action=unwatch (and submit the confirmation form), that POST response has at the top of it a solid blue star. A refresh corrects the error.
Created attachment 10617
bug: the star should be blue after watching the page
I confirm this following these steps:
- [[User:Js/watchlist.js]] was not in my watchlist
- I went to
- I answered [yes] to the question "Add this page to your watchlist?"
- The page was reloaded, and there was a message "The page "User:Js/watchlist.js" has been added to your watchlist...", but the star was still white (see screenshot)
- Reloading the page (by clicking in the "User page" link) fixed the star color.
Since that action doesn't redirect, then the isWatched() call probably happens before the update is commit, each being read from different servers. It would need to force the new value via some method, or redirect, or have isWatched() check hasOrMadeRecentMasterChanges().
I still can reproduce this bug on enwiki by the steps from comment T28292#306400.
Can a change like https://gerrit.wikimedia.org/r/#/c/263673/2/includes/AjaxDispatcher.php fix this problem?
This patch helps ensure that after adding a page to the watchlist, the confirmation page will show "Unwatch" instead of "Watch".
However, the reverse use case (removing a page from the watchlist) is not yet covered because WatchedItemStore only caches presence of values, not absence.