Page MenuHomePhabricator

Add a watchlist parameter option to only watch unwatched pages
Open, Needs TriagePublicFeature

Description

Feature summary (what you would like to be able to do and where):
The watchlist parameter for the action API currently accepts watch, unwatch, preferences and nochange. I propose adding watchifnew or something similar to watch the page only if the user hasn't already watched it.

Use case(s) (list the steps that you performed to discover that problem, and describe the actual underlying problem which you want to solve. Do not describe only a solution):
Suppose:

  • User:Foo has watched page A without an expiry.
  • Foo uses a user script that may alter their watchlist settings.
  • Foo then performs an action on A and has watchlistexpiry set to 1 month for that action, intended only for pages they are not yet watching (and therefore should not apply to A, whose indefinite watch should be preserved).

Under the current API behavior, watching a page only if it is not already watched requires the client to make an additional API request before the main action to check the current watch state.

Benefits (why should this be implemented?):

  • It may reduce the total number of API calls, because clients would no longer need to make a preliminary request when an action may modify a watchlist entry.
  • JavaScript tools will be easier to maintain, as they will not need extra logic to perform such pre-checks.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

Change #1214600 had a related patch set uploaded (by Dragoniez; author: Dragoniez):

[mediawiki/core@master] API: Add `watchifnew` watchlist option to avoid overwriting existing watches

https://gerrit.wikimedia.org/r/1214600