Page MenuHomePhabricator

Expose watchlist (expiry) status to JS without another query
Open, Needs TriagePublicFeature


As a developer, I want my tool to edit/protect/whatever a page, watching the page (via the watchlist parameter) at the same time. If a watchlist expiry is specified, however, I face the following:

  • An indefinitely-watched page should generally not be replaced with an expiry, so I cannot blindly provide watchlistexpiry for fear of overwriting a page's watch status.
  • That means waiting for a separate prop=info&inprop=watched query to resolve before every action.
    • That query also only provides a boolean (until/if T268834), so I've no idea if a page is being watched indefinitely or temporarily, meaning I can either risk turning indefinite into temporary or opt not to ever extend an existing expiration.

I understand that the user-facing mw.config set is ideally kept small, but it'd dramatically simplify handling of watchlisting to have the watchlist status accessible (parsing document.querySelector('.mw-watchlink a').title isn't exactly viable).

I suppose an alternative option would be some additional "extend-expiry-but-don't-overwrite-indefinite-watching" parameter added to everything, but I imagine that'd be far more confusing.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Amorymeltzer changed the subtype of this task from "Task" to "Feature Request".Dec 13 2020, 9:01 PM

Server-side, there is a process cache on the WatchedItem for whatever page you're viewing, so I would guess exposing watch status info through mw.config wouldn't cost anything. But, it does pollute the client with information that may not be used often. I don't know what the rules are as far as what should be exposed, but my gut tells me you'll just have to make a separate API request. That said T268834 certainly deserves some attention.

That, and: since I can toggle my watchlist freely on the page, I think that would make it the *only* mw.config item to be able to change once the page has loaded? That would be weird.