Merge "Revert "ServiceWiring: Avoid usage of deprecated Title::getSubjectPage()""

This commit is contained in:
jenkins-bot 2020-08-11 16:14:36 +00:00 committed by Gerrit Code Review
commit 5e43bf1ef2
3 changed files with 3 additions and 20 deletions

View file

@ -84,11 +84,10 @@ return [
$user = $context->getUser();
$userPageHelper = $services->getService( 'Minerva.SkinUserPageHelper' );
$languagesHelper = $services->getService( 'Minerva.LanguagesHelper' );
$namespaceInfo = $services->getNamespaceInfo();
$relevantUserPageHelper = $title->inNamespace( NS_USER_TALK ) ?
new SkinUserPageHelper(
$namespaceInfo->getSubjectPage( $context->getSkin()->getRelevantTitle() )
$context->getSkin()->getRelevantTitle()->getSubjectPage()
) :
$userPageHelper;

View file

@ -20,7 +20,6 @@
namespace MediaWiki\Minerva\Skins;
use MediaWiki\Linker\LinkTarget;
use Title;
use User;
@ -40,9 +39,9 @@ class SkinUserPageHelper {
private $pageUser;
/**
* @param Title|LinkTarget|null $title
* @param Title|null $title
*/
public function __construct( $title = null ) {
public function __construct( Title $title = null ) {
$this->title = $title;
}

View file

@ -2,7 +2,6 @@
namespace Tests\MediaWiki\Minerva;
use MediaWiki\Linker\LinkTarget;
use MediaWiki\Minerva\Skins\SkinUserPageHelper;
use MediaWikiTestCase;
use Title;
@ -25,20 +24,6 @@ class SkinUserPageHelperTest extends MediaWikiTestCase {
$this->assertFalse( $helper->isUserPage() );
}
/**
* @covers ::isUserPage
* @covers ::getPageUser
*/
public function testLinkTargetAsConsumer() {
$linkTarget = $this->createMock( LinkTarget::class );
$linkTarget->method( 'getText' )
->willReturn( 'User:LinkTarget' );
$helper = new SkinUserPageHelper( $linkTarget );
$this->assertNull( $helper->getPageUser() );
$this->assertFalse( $helper->isUserPage() );
}
/**
* @covers ::isUserPage
* @covers ::fetchData