Merge "Replace deprecated Linker::formatComment/formatLinksInComment"

This commit is contained in:
jenkins-bot 2022-12-15 23:31:54 +00:00 committed by Gerrit Code Review
commit bed00a9140
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' )