X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiQueryWatchlist.php;h=2ab85240d8fa151c09c5d67d6acb89e7ab9b3510;hb=da4a98830bf715bdc7bac38d61dc5ec401d99285;hp=f8f6e7d8a1086f329f778729328a9bcab35af7bd;hpb=424251a2cb5842727756d96f877c787c443ea056;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiQueryWatchlist.php b/includes/api/ApiQueryWatchlist.php index f8f6e7d8a1..2ab85240d8 100644 --- a/includes/api/ApiQueryWatchlist.php +++ b/includes/api/ApiQueryWatchlist.php @@ -34,6 +34,8 @@ use MediaWiki\MediaWikiServices; */ class ApiQueryWatchlist extends ApiQueryGeneratorBase { + private $commentStore; + public function __construct( ApiQuery $query, $moduleName ) { parent::__construct( $query, $moduleName, 'wl' ); } @@ -85,6 +87,10 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase { $this->dieWithError( 'apierror-permissiondenied-patrolflag', 'patrol' ); } } + + if ( $this->fld_comment || $this->fld_parsedcomment ) { + $this->commentStore = new CommentStore( 'rc_comment' ); + } } $options = [ @@ -179,7 +185,7 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase { $watchedItemQuery = MediaWikiServices::getInstance()->getWatchedItemQueryService(); $items = $watchedItemQuery->getWatchedItemsWithRecentChangeInfo( $wlowner, $options, $startFrom ); - foreach ( $items as list ( $watchedItem, $recentChangeInfo ) ) { + foreach ( $items as list( $watchedItem, $recentChangeInfo ) ) { /** @var WatchedItem $watchedItem */ if ( is_null( $resultPageSet ) ) { $vals = $this->extractOutputData( $watchedItem, $recentChangeInfo ); @@ -353,12 +359,13 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase { Revision::DELETED_COMMENT, $user ) ) { - if ( $this->fld_comment && isset( $recentChangeInfo['rc_comment'] ) ) { - $vals['comment'] = $recentChangeInfo['rc_comment']; + $comment = $this->commentStore->getComment( $recentChangeInfo )->text; + if ( $this->fld_comment ) { + $vals['comment'] = $comment; } - if ( $this->fld_parsedcomment && isset( $recentChangeInfo['rc_comment'] ) ) { - $vals['parsedcomment'] = Linker::formatComment( $recentChangeInfo['rc_comment'], $title ); + if ( $this->fld_parsedcomment ) { + $vals['parsedcomment'] = Linker::formatComment( $comment, $title ); } } }