Remove unnecessary use of Parser

Change-Id: Ib86ed6300ae85d7d69557a11bbd8f7b409e11d6c
This commit is contained in:
C. Scott Ananian 2023-07-20 10:27:06 -04:00 committed by Bartosz Dziewoński
parent fce524c9f8
commit 0de3f468c3
2 changed files with 3 additions and 5 deletions

View file

@ -12,7 +12,6 @@ use MediaWiki\MediaWikiServices;
use MediaWiki\User\UserIdentity; use MediaWiki\User\UserIdentity;
use MWExceptionHandler; use MWExceptionHandler;
use MWTimestamp; use MWTimestamp;
use Parser;
use ParserOutput; use ParserOutput;
use Sanitizer; use Sanitizer;
use Throwable; use Throwable;
@ -49,10 +48,9 @@ class CommentFormatter {
* *
* @param string &$text Parser text output (modified by reference) * @param string &$text Parser text output (modified by reference)
* @param ParserOutput $pout ParserOutput object for metadata, e.g. parser limit report * @param ParserOutput $pout ParserOutput object for metadata, e.g. parser limit report
* @param Parser $parser * @param Title $title
*/ */
public static function addDiscussionTools( string &$text, ParserOutput $pout, Parser $parser ): void { public static function addDiscussionTools( string &$text, ParserOutput $pout, Title $title ): void {
$title = $parser->getTitle();
$start = microtime( true ); $start = microtime( true );
$requestId = null; $requestId = null;

View file

@ -65,7 +65,7 @@ class ParserHooks implements
// the user doesn't have DiscussionTools features enabled. // the user doesn't have DiscussionTools features enabled.
if ( HookUtils::isAvailableForTitle( $title ) ) { if ( HookUtils::isAvailableForTitle( $title ) ) {
// This modifies $text // This modifies $text
CommentFormatter::addDiscussionTools( $text, $pout, $parser ); CommentFormatter::addDiscussionTools( $text, $pout, $title );
if ( $parser->getOptions()->getIsPreview() ) { if ( $parser->getOptions()->getIsPreview() ) {
$text = CommentFormatter::removeInteractiveTools( $text ); $text = CommentFormatter::removeInteractiveTools( $text );