Merge "Avoid using ContentHandler::getContentText()"

This commit is contained in:
jenkins-bot 2021-07-12 14:22:05 +00:00 committed by Gerrit Code Review
commit 98d7428837
2 changed files with 7 additions and 3 deletions

View file

@ -517,13 +517,15 @@ abstract class EchoDiscussionParser {
$store = MediaWikiServices::getInstance()->getRevisionStore();
$prevRevision = $store->getRevisionById( $revision->getParentId() );
if ( $prevRevision ) {
$prevText = ContentHandler::getContentText( $prevRevision->getContent( SlotRecord::MAIN ) ) ?: '';
$prevContent = $prevRevision->getContent( SlotRecord::MAIN );
$prevText = ( $prevContent instanceof TextContent ) ? $prevContent->getText() : '';
}
}
$content = $revision->getContent( SlotRecord::MAIN );
$changes = self::getMachineReadableDiff(
$prevText,
ContentHandler::getContentText( $revision->getContent( SlotRecord::MAIN ) )
( $content instanceof TextContent ) ? $content->getText() : null
);
$output = self::interpretDiff(
$changes,

View file

@ -34,7 +34,9 @@ class EchoOnWikiList implements EchoContainmentList {
if ( $article === null || !$article->exists() ) {
return [];
}
$text = ContentHandler::getContentText( $article->getContent() );
$content = $article->getContent();
$text = ( $content instanceof TextContent ) ? $content->getText() : null;
if ( $text === null ) {
return [];
}