Merge "Pass a user to WikiPage::prepareContentForEdit()"

This commit is contained in:
jenkins-bot 2021-06-28 22:50:38 +00:00 committed by Gerrit Code Review
commit 2deac909ad
2 changed files with 11 additions and 3 deletions

View file

@ -189,7 +189,11 @@ class LazyVariableComputer {
$new_text = $getVarCB( $textVar )->toString();
$content = ContentHandler::makeContent( $new_text, $article->getTitle() );
$editInfo = $article->prepareContentForEdit( $content );
$editInfo = $article->prepareContentForEdit(
$content,
null,
$parameters['contextUser']
);
$result = array_keys( $editInfo->output->getExternalLinks() );
self::$profilingExtraTime += ( microtime( true ) - $startTime );
break;
@ -253,7 +257,11 @@ class LazyVariableComputer {
$new_text = $getVarCB( $textVar )->toString();
$content = ContentHandler::makeContent( $new_text, $article->getTitle() );
$editInfo = $article->prepareContentForEdit( $content );
$editInfo = $article->prepareContentForEdit(
$content,
null,
$parameters['contextUser']
);
if ( isset( $parameters['pst'] ) && $parameters['pst'] ) {
$result = $editInfo->pstContent->serialize( $editInfo->format );
} else {

View file

@ -46,7 +46,7 @@ class LazyVariableComputerDBTest extends MediaWikiIntegrationTestCase {
] );
$generator = AbuseFilterServices::getVariableGeneratorFactory()->newGenerator( $baseVars );
$actualHolder = $generator->addEditVars( $page, $this->createMock( User::class ) )
$actualHolder = $generator->addEditVars( $page, $this->getTestUser()->getUser() )
->getVariableHolder();
$actual = AbuseFilterServices::getVariablesManager()->exportAllVars( $actualHolder );