Hard deprecate WatchAction::getWatchToken

Bug: T265944
Change-Id: I1f7f0cdfa59d421b1f0f29fe9aba906dde4e5bf1
This commit is contained in:
vladshapik 2021-06-23 20:19:59 +03:00 committed by Vlad.shapik
parent 58efa8ec33
commit 860ac3bbc8
3 changed files with 7 additions and 0 deletions

View file

@ -296,6 +296,8 @@ because of Phabricator reports.
instead.
* Deprecated WatchAction::doWatch() and WatchAction::doUnwatch(). Use
WatchlistManager::addWatch() or WatchlistManager::removeWatch(), instead.
* WatchAction::getWatchToken is hard deprecated. Instead use
CsrfTokenSet::getToken
* The getTitle() and setTitle() methods in Parser have been deprecated.
Use getPage() and setPage() instead.
* Title::isWatchable() has been deprecated. Use WatchlistManager::isWatchable()

View file

@ -318,6 +318,8 @@ class WatchAction extends FormAction {
/**
* Get token to watch (or unwatch) a page for a user
*
* @deprecated since 1.37, use CsrfTokenSet::getToken
*
* @param PageIdentity $page Title object of page to watch
* @param User $user User for whom the action is going to be performed
* @param string $action Optionally override the action to 'unwatch'
@ -325,6 +327,7 @@ class WatchAction extends FormAction {
* @since 1.18
*/
public static function getWatchToken( PageIdentity $page, User $user, $action = 'watch' ) {
wfDeprecated( __METHOD__, '1.37' );
if ( $action != 'unwatch' ) {
$action = 'watch';
}

View file

@ -440,6 +440,7 @@ class WatchActionTest extends MediaWikiIntegrationTestCase {
* @throws Exception
*/
public function testGetWatchTokenNormalizesToWatch() {
$this->hideDeprecated( 'WatchAction::getWatchToken' );
$user = $this->createMock( User::class );
$user->expects( $this->once() )
->method( 'getEditToken' )
@ -453,6 +454,7 @@ class WatchActionTest extends MediaWikiIntegrationTestCase {
* @throws Exception
*/
public function testGetWatchTokenProxiesUserGetEditToken() {
$this->hideDeprecated( 'WatchAction::getWatchToken' );
$user = $this->createMock( User::class );
$user->expects( $this->once() )->method( 'getEditToken' );