mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-11-24 07:54:13 +00:00
Migrate DiscussionParser::getEditExcerpt() to accept only RevisionRecord
Follow up on Icfc85167a636bef95daab2. Bug: T221163 Depends-On: I31d819f4453032da8deb117254b954fba058e0a3 Change-Id: I3d997f9e8d4bd1566ec6fd8fe2d33be5161458b3
This commit is contained in:
parent
8e5aa13a73
commit
76544df40a
|
@ -441,12 +441,11 @@ abstract class EchoDiscussionParser {
|
|||
* Given a Revision object, returns a talk-page-centric interpretation
|
||||
* of the changes made in it.
|
||||
*
|
||||
* @param RevisionRecord|Revision $revision Keeping Revision for back-compat with other extension that
|
||||
* may need Revision before the full migration.
|
||||
* @param RevisionRecord $revision
|
||||
* @see EchoDiscussionParser::interpretDiff
|
||||
* @return array[] See {@see interpretDiff} for details.
|
||||
*/
|
||||
private static function getChangeInterpretationForRevision( $revision ) {
|
||||
private static function getChangeInterpretationForRevision( RevisionRecord $revision ) {
|
||||
if ( $revision->getId() && isset( self::$revisionInterpretationCache[$revision->getId()] ) ) {
|
||||
return self::$revisionInterpretationCache[$revision->getId()];
|
||||
}
|
||||
|
@ -1213,13 +1212,12 @@ abstract class EchoDiscussionParser {
|
|||
/**
|
||||
* Extract an edit excerpt from a revision
|
||||
*
|
||||
* @param Revision|RevisionRecord $revision Keeping Revision for back-compat with other extension that
|
||||
* may need Revision before the full migration.
|
||||
* @param RevisionRecord $revision
|
||||
* @param Language $lang
|
||||
* @param int $length Length in characters (not bytes); default 150
|
||||
* @return string
|
||||
*/
|
||||
public static function getEditExcerpt( $revision, Language $lang, $length = 150 ) {
|
||||
public static function getEditExcerpt( RevisionRecord $revision, Language $lang, $length = 150 ) {
|
||||
$interpretation = self::getChangeInterpretationForRevision( $revision );
|
||||
$section = self::detectSectionTitleAndText( $interpretation );
|
||||
return $lang->truncateForVisual( $section['section-title'] . ' ' . $section['section-text'], $length );
|
||||
|
|
Loading…
Reference in a new issue