[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Page MenuHomePhabricator

Watchlist expiry API: Add a expiry parameter when adding an item to the watchlist [medium]
Closed, ResolvedPublic

Description

As a Watchlist Expiry user, I want expiry parameters enabled when adding items to the watchlist via the API, so the feature can be accessed via the API.

Background: This ticket is for back-end work only.

Acceptance Criteria:

  • When adding an item to the watchlist through the API, add a parameter for expiry so the item can be added with an expiration.
  • Note: there is *one* expiry value allowed, even for bulk additions. Whatever is supplied, all added items will receive the same expiry value.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
ifried renamed this task from Watchlist expiry API: Add a expiry parameter when adding an item to the watchlist to Watchlist expiry API: Add a expiry parameter when adding an item to the watchlist [medium].Feb 13 2020, 6:19 PM
ifried moved this task from Needs Discussion to Up Next (June 3-21) on the Community-Tech board.

Change 572107 had a related patch set uploaded (by MusikAnimal; owner: MusikAnimal):
[mediawiki/core@master] [WIP] Introduce an expiry to WatchlistItem

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

I'm going to stop here and ask for feedback on my approach.

The biggest problem I see is that we're doing a multi-insert into the watchlist table, but we need the generated wl_ids in order to update watchlist_expiry. So, I guess we have to either switch to single inserts (and I think get the wl_id with Database::insertId()) or manually fetch the IDs before updating watchlist_expiry, maybe in a deferred update?

Other to-dos:

  • Make the hooks WatchArticle and WatchArticleComplete accept the expiry (though they don't have to make use of them)
  • Make method(s) to modify the expiry
  • ...

This is a good question. My first instinct would be to do single inserts inside a database transaction.

I'll take a look at the code and see if something else jumps out.

MusikAnimal subscribed.

Unassiging until T245213 is resolved.

Change 580522 had a related patch set uploaded (by MusikAnimal; owner: MusikAnimal):
[mediawiki/core@master] [WIP] Add expiry support to Watch API

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

Change 580522 merged by jenkins-bot:
[mediawiki/core@master] ApiWatch: Add support for expiries

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

Change 583513 had a related patch set uploaded (by Samwilson; owner: Samwilson):
[mediawiki/core@master] Add release notes for recently-merged watchlist expiry work

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

dom_walden subscribed.

When using the Watch API:

  • When watching an item without setting the expiry parameter:
    • If the item is not watched, it is watched without an expiry
    • If the item is already watched with an expiry, the expiry is unchanged

The API response looks something like, showing the expiry time for the watched item:
{'batchcomplete': '', 'watch': [{'title': 'Foobar', 'ns': 0, 'expiry': '2020-03-30T14:44:32Z', 'watched': ''}]}

You can watch an item with a different expiry time, modifying the expiry time in the DB. If the expiry time is "infinite", the expiry is removed from the database.

Unwatching an item also removes the expiry from the DB, before and after it has expired.

You can also use generators to, for example, set the expiry time of all(?) the user's watched items to 1 minute, e.g. https://en.wikipedia.beta.wmflabs.org/wiki/Special:ApiSandbox#action=watch&format=json&expiry=1%20minute&generator=watchlistraw

Change 583513 merged by jenkins-bot:
[mediawiki/core@master] Add release notes for recently-merged watchlist expiry work

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

ifried moved this task from Product sign-off to Done on the Community-Tech (Kanban-2019-20-Q4) board.
ifried subscribed.

The work has been deployed. There is nothing directly user-facing to test here, and the changes have been tested by Dom. For this reason, I'm marking it as Done.