mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-11-15 20:00:38 +00:00
Merge "Replace deprecated Linker::formatComment/formatLinksInComment"
This commit is contained in:
commit
bed00a9140
|
@ -1264,7 +1264,8 @@ abstract class EchoDiscussionParser {
|
||||||
*/
|
*/
|
||||||
public static function getTextSnippetFromSummary( $text, Language $lang, $length = self::DEFAULT_SNIPPET_LENGTH ) {
|
public static function getTextSnippetFromSummary( $text, Language $lang, $length = self::DEFAULT_SNIPPET_LENGTH ) {
|
||||||
// Parse wikitext with summary parser
|
// Parse wikitext with summary parser
|
||||||
$html = Linker::formatLinksInComment( Sanitizer::escapeHtmlAllowEntities( $text ) );
|
$html = MediaWikiServices::getInstance()->getCommentFormatter()
|
||||||
|
->formatLinks( Sanitizer::escapeHtmlAllowEntities( $text ) );
|
||||||
$plaintext = trim( Sanitizer::stripAllTags( $html ) );
|
$plaintext = trim( Sanitizer::stripAllTags( $html ) );
|
||||||
return $lang->truncateForVisual( $plaintext, $length );
|
return $lang->truncateForVisual( $plaintext, $length );
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
namespace MediaWiki\Extension\Notifications\Formatters;
|
namespace MediaWiki\Extension\Notifications\Formatters;
|
||||||
|
|
||||||
use Linker;
|
use MediaWiki\MediaWikiServices;
|
||||||
use MediaWiki\Revision\RevisionRecord;
|
use MediaWiki\Revision\RevisionRecord;
|
||||||
use Sanitizer;
|
use Sanitizer;
|
||||||
|
|
||||||
|
@ -28,7 +28,8 @@ class EchoMentionInSummaryPresentationModel extends EchoEventPresentationModel {
|
||||||
$revision = $this->event->getRevision();
|
$revision = $this->event->getRevision();
|
||||||
if ( $revision && $revision->getComment() && $this->userCan( RevisionRecord::DELETED_COMMENT ) ) {
|
if ( $revision && $revision->getComment() && $this->userCan( RevisionRecord::DELETED_COMMENT ) ) {
|
||||||
$summary = $revision->getComment()->text;
|
$summary = $revision->getComment()->text;
|
||||||
$summary = Linker::formatComment( $summary );
|
$summary = MediaWikiServices::getInstance()->getCommentFormatter()
|
||||||
|
->format( $summary );
|
||||||
$summary = Sanitizer::stripAllTags( $summary );
|
$summary = Sanitizer::stripAllTags( $summary );
|
||||||
|
|
||||||
return $this->msg( 'notification-body-mention' )
|
return $this->msg( 'notification-body-mention' )
|
||||||
|
|
Loading…
Reference in a new issue