WatchAction::doWatchOrUnwatch needs some services
https://codesearch.wmcloud.org/search/?q=WatchAction&i=nope&files=&repos=
WatchAction::doWatchOrUnwatch needs some services
https://codesearch.wmcloud.org/search/?q=WatchAction&i=nope&files=&repos=
Subject | Repo | Branch | Lines +/- | |
---|---|---|---|---|
Hard deprecate WatchAction::getWatchToken | mediawiki/core | master | +7 -0 |
Status | Subtype | Assigned | Task | ||
---|---|---|---|---|---|
Open | None | T259960 Inject services into API modules and special pages | |||
Resolved | Vlad.shapik | T265944 Make class WatchAction a real action class and move helper function to own service | |||
Resolved | CCicalese_WMF | T280750 Hard deprecate watchlist methods in WatchAction | |||
Resolved | Vlad.shapik | T285399 extensions/LiquidThreads: avoid using WatchAction::getWatchToken |
This is not T253078: Create ActionFactory, add dependency injection to actions, because that the non-static part of the class. This is the static part.
If WatchAction::doWatchOrUnwatch moves, so should WatchAction::doWatch and WatchAction::doUnwatch
The following services should be injected to the new service:
WatchedItemStore - currently retrieved from MediaWikiServices
PermissionManager - currently retrieved from MediaWikiServices
HookContainer - currently used via Hooks::runner()
The WatchAction methods use calls to User::addWatch and ::removeWatch, which internally use a PermissionManager and a WatchedItemStore. Thus, I would suggest that the new service avoid using the user methods, and instead the user methods be deprecated in favor of calls to the new service.
Alternatively, the code could all be moved into the existing WatchedItemStore
@Pchelolo WatchAction::doWatchOrUnwatch, doWatch, and doUnwatch still have all of the logic - this doesn't appear to have been done
Oh, I resolved it by mistake. Mostly wanted to CC Cindy since she's working on this area.
I should have linked this task from the relevant patches (https://gerrit.wikimedia.org/r/c/mediawiki/core/+/678679 and https://gerrit.wikimedia.org/r/c/mediawiki/core/+/681141). The following were done in those patches:
I will be working on removing remaining uses of and hard deprecating the methods in WatchAction.
The remaining functions still need to be addressed (I'm not currently working on them, so they're free to be picked up by somebody else if they want):
I don't think getExpiryOptions necessarily need to be addressed right away, it's just rendering localized names for possible expiry options, so it's fine to live in WatchAction.
WatchAction::getWatchToken though needs to be hard-deprecated. Should be done after https://gerrit.wikimedia.org/r/c/mediawiki/core/+/697639 is merged.
Change 701161 had a related patch set uploaded (by Vlad.shapik; author: Vlad.shapik):
[mediawiki/core@master] Hard deprecate WatchAction::getWatchToken
Change 701161 merged by jenkins-bot:
[mediawiki/core@master] Hard deprecate WatchAction::getWatchToken