*/
class ApiQueryWatchlist extends ApiQueryGeneratorBase {
+ /** @var CommentStore */
+ private $commentStore;
+
public function __construct( ApiQuery $query, $moduleName ) {
parent::__construct( $query, $moduleName, 'wl' );
}
$this->dieWithError( 'apierror-permissiondenied-patrolflag', 'patrol' );
}
}
+
+ if ( $this->fld_comment || $this->fld_parsedcomment ) {
+ $this->commentStore = new CommentStore( 'rc_comment' );
+ }
}
$options = [
private function extractOutputData( WatchedItem $watchedItem, array $recentChangeInfo ) {
/* Determine the title of the page that has been changed. */
- $title = Title::makeTitle(
- $watchedItem->getLinkTarget()->getNamespace(),
- $watchedItem->getLinkTarget()->getDBkey()
- );
+ $title = Title::newFromLinkTarget( $watchedItem->getLinkTarget() );
$user = $this->getUser();
/* Our output data. */
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 );
}
}
}