From f45b40fe531a8fa5324ebf4bc8a803ff694b044f Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Thu, 17 Aug 2017 13:53:01 -0700 Subject: [PATCH] Restore the newFromId() approach in SpecialNewpages::feedItemDesc Trying to use the row data is problematic since the text related fields are missing. This fixing a regression from 4475e1c8c. Also make SpecialNewpages::feedItemDesc() handle null content. Bug: T173541 Change-Id: I2213675d3392c6e9761bdc7acde35fd1caee4517 --- includes/specials/SpecialNewpages.php | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/includes/specials/SpecialNewpages.php b/includes/specials/SpecialNewpages.php index 6a7971435a..e3b73a98b0 100644 --- a/includes/specials/SpecialNewpages.php +++ b/includes/specials/SpecialNewpages.php @@ -494,17 +494,22 @@ class SpecialNewpages extends IncludableSpecialPage { } protected function feedItemDesc( $row ) { - $revision = $this->revisionFromRcResult( $row ); - if ( $revision ) { - // XXX: include content model/type in feed item? - return '

' . htmlspecialchars( $revision->getUserText() ) . - $this->msg( 'colon-separator' )->inContentLanguage()->escaped() . - htmlspecialchars( FeedItem::stripComment( $revision->getComment() ) ) . - "

\n
\n
" . - nl2br( htmlspecialchars( $revision->getContent()->serialize() ) ) . "
"; + $revision = Revision::newFromId( $row->rev_id ); + if ( !$revision ) { + return ''; } - return ''; + $content = $revision->getContent(); + if ( $content === null ) { + return ''; + } + + // XXX: include content model/type in feed item? + return '

' . htmlspecialchars( $revision->getUserText() ) . + $this->msg( 'colon-separator' )->inContentLanguage()->escaped() . + htmlspecialchars( FeedItem::stripComment( $revision->getComment() ) ) . + "

\n
\n
" . + nl2br( htmlspecialchars( $content->serialize() ) ) . "
"; } protected function getGroupName() { -- 2.20.1