Page MenuHomePhabricator

Refactor watchlist related API classes to use WatchedItemStore
Closed, ResolvedPublic

Description

  • ApiQueryInfo
  • ApiQueryUserInfo
  • ApiQueryWatchlist
  • ApiQueryWatchlistRaw

Event Timeline

The API has a very tangled use of the watchlist table (as in it is intertwined with many other things).
This will likely be hard to extract into the Store and may not happen (or may not happen until someone with a better knowledge of the API areas takes a look)

Change 266572 had a related patch set uploaded (by Addshore):
Move counting of watchers to WatchedItemStore

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

Change 276441 had a related patch set uploaded (by Addshore):
Add countUnreadNotifications to WatchedItemStore

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

The API has a very tangled use of the watchlist table (as in it is intertwined with many other things).

It's not really that tangled. Your confusion mentioned on I2868c31f seems to be because ApiQueryBase uses various methods to manage the building of the $table, $vars, $conds, $options, and $join_conds parameters to be passed to Database::select():

  • ApiQueryBase::addTables() appends to $tables.
  • ApiQueryBase::addJoinConds() appends to $join_conds.
  • ApiQueryBase::addFields() and ApiQueryBase::addFieldsIf() append to $vars.
  • ApiQueryBase::addWhere(), ApiQueryBase::addWhereIf(), ApiQueryBase::addWhereField(), ApiQueryBase::addWhereRange(), and ApiQueryBase::addTimestampWhereRange() append to $where.
  • ApiQueryBase::addOption(), ApiQueryBase::addWhereRange(), and ApiQueryBase::addTimestampWhereRange() append to $options.

The other bit of difficulty is probably due to the need for batch operations.

As for the modules themselves,

Change 277488 had a related patch set uploaded (by WMDE-leszek):
Add WatchedItemStore::countVisitingWatchersMultiple

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

Change 266572 merged by jenkins-bot:
Move counting of watchers to WatchedItemStore

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

Change 276441 merged by jenkins-bot:
Add countUnreadNotifications to WatchedItemStore

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

Change 277528 had a related patch set uploaded (by Addshore):
Fix ApiQueryInfo break from use of WatchedItemStore

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

Change 277528 merged by jenkins-bot:
Fix ApiQueryInfo break from use of WatchedItemStore

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

Change 277788 had a related patch set (by WMDE-leszek) published:
Fix ApiQueryInfo response for prop=watchers

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

Change 277788 merged by jenkins-bot:
Fix ApiQueryInfo response for prop=watchers

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

Change 277488 merged by jenkins-bot:
Add WatchedItemStore::countVisitingWatchersMultiple

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

Change 278283 had a related patch set uploaded (by WMDE-leszek):
Use WatchedItemStore in ApiQueryInfo::getWatchedInfo

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

Change 278283 merged by jenkins-bot:
Use WatchedItemStore in ApiQueryInfo::getWatchedInfo

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

Change 278859 had a related patch set uploaded (by WMDE-leszek):
Use WatchedItemStore::getWatchedItemsForUser in ApiQueryWatchlistRaw

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