Description
Details
Subject | Repo | Branch | Lines +/- | |
---|---|---|---|---|
ApiQueryInfo: Return watchlist expiry when applicable for inprop=watched | mediawiki/core | master | +241 -109 |
Related Objects
- Mentioned In
- T271804: PHP Notice: Undefined index: Alsjdakjsdh
T269446: Build Watchlist add/remove workflow from article
T270057: Expose watchlist (expiry) status to JS without another query - Mentioned Here
- rMW90996aa040c9: Localisation updates from https://translatewiki.net.
T254141: Watchlist expiry: When unwatching via API, report how long was left
T263796: Watchlist query api should report time remaining
Event Timeline
To clarify (@DannyS712 you might be able to correct me if I'm wrong) without this, I don't think there's a reliable way to get watchlist expiry status for a given page? T263796 helps but wouldn't cover it.
Change 649736 had a related patch set uploaded (by MusikAnimal; owner: MusikAnimal):
[mediawiki/core@master] [WIP] ApiQueryInfo: Return watchlist expiry instead of true
Change 649736 merged by jenkins-bot:
[mediawiki/core@master] ApiQueryInfo: Return watchlist expiry when applicable for inprop=watched
When looking up information for a page via the api, you can now return the watch expiry.
The response if the page is temporarily watched is something like:
{ "title": <title>, ... "watched": "", "watchlistexpiry": "2021-07-11T08:59:22Z" }
If it is watched permanently, the response is like:
{ "title": <title>, ... "watched": "" }
This change slightly re-wrote a function used elsewhere. I tested other parts of the code which use this function. I did not find any problems.
Test Environment https://en.wikipedia.beta.wmflabs.org MediaWiki 1.36.0-alpha (90996aa) 07:32, 11 January 2021.
Just to confirm @MusikAnimal, am I right that this change has also tweaked (corrected?) the return value of watched when using format=json&formatversion=2? Without this change, a title I'm not watching returns "watched": false while after this change, it does not return watched. That's seems more correct, but just wanted to confirm since it wasn't mentioned.
The intention was to not change any long-standing behaviour. But it looks the fix at https://gerrit.wikimedia.org/r/c/mediawiki/core/+/655665 restored the "watched":false, so we're good :) With this API, you have to pass in inprop=watched to get any watch info, so I think it's appropriate to always return a value for watched (since you're explicitly asking for it).
This is now on production, and we're not experiencing errors. Also, I am seeing the same behavior, as described by Dom, when I test on production. For these reasons, I'm marking this as Done.