Replace deprecated Linker::formatComment/formatLinksInComment

Bug: T324906
Change-Id: I8cd6ce852156d8c2c9e0da6218a62a2befe40ef3
This commit is contained in:
Umherirrender 2022-12-10 22:47:49 +01:00
parent 4d44d4f900
commit af15ecbc29
2 changed files with 5 additions and 3 deletions

View file

@ -1264,7 +1264,8 @@ abstract class EchoDiscussionParser {
*/
public static function getTextSnippetFromSummary( $text, Language $lang, $length = self::DEFAULT_SNIPPET_LENGTH ) {
// Parse wikitext with summary parser
$html = Linker::formatLinksInComment( Sanitizer::escapeHtmlAllowEntities( $text ) );
$html = MediaWikiServices::getInstance()->getCommentFormatter()
->formatLinks( Sanitizer::escapeHtmlAllowEntities( $text ) );
$plaintext = trim( Sanitizer::stripAllTags( $html ) );
return $lang->truncateForVisual( $plaintext, $length );
}

View file

@ -2,7 +2,7 @@
namespace MediaWiki\Extension\Notifications\Formatters;
use Linker;
use MediaWiki\MediaWikiServices;
use MediaWiki\Revision\RevisionRecord;
use Sanitizer;
@ -28,7 +28,8 @@ class EchoMentionInSummaryPresentationModel extends EchoEventPresentationModel {
$revision = $this->event->getRevision();
if ( $revision && $revision->getComment() && $this->userCan( RevisionRecord::DELETED_COMMENT ) ) {
$summary = $revision->getComment()->text;
$summary = Linker::formatComment( $summary );
$summary = MediaWikiServices::getInstance()->getCommentFormatter()
->format( $summary );
$summary = Sanitizer::stripAllTags( $summary );
return $this->msg( 'notification-body-mention' )