Skip to content

Commit f45b40f

Browse files
committed
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 4475e1c. Also make SpecialNewpages::feedItemDesc() handle null content. Bug: T173541 Change-Id: I2213675d3392c6e9761bdc7acde35fd1caee4517
1 parent 9c679cf commit f45b40f

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

includes/specials/SpecialNewpages.php

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -494,17 +494,22 @@ protected function feedItemAuthor( $row ) {
494494
}
495495

496496
protected function feedItemDesc( $row ) {
497-
$revision = $this->revisionFromRcResult( $row );
498-
if ( $revision ) {
499-
// XXX: include content model/type in feed item?
500-
return '<p>' . htmlspecialchars( $revision->getUserText() ) .
501-
$this->msg( 'colon-separator' )->inContentLanguage()->escaped() .
502-
htmlspecialchars( FeedItem::stripComment( $revision->getComment() ) ) .
503-
"</p>\n<hr />\n<div>" .
504-
nl2br( htmlspecialchars( $revision->getContent()->serialize() ) ) . "</div>";
497+
$revision = Revision::newFromId( $row->rev_id );
498+
if ( !$revision ) {
499+
return '';
505500
}
506501

507-
return '';
502+
$content = $revision->getContent();
503+
if ( $content === null ) {
504+
return '';
505+
}
506+
507+
// XXX: include content model/type in feed item?
508+
return '<p>' . htmlspecialchars( $revision->getUserText() ) .
509+
$this->msg( 'colon-separator' )->inContentLanguage()->escaped() .
510+
htmlspecialchars( FeedItem::stripComment( $revision->getComment() ) ) .
511+
"</p>\n<hr />\n<div>" .
512+
nl2br( htmlspecialchars( $content->serialize() ) ) . "</div>";
508513
}
509514

510515
protected function getGroupName() {

0 commit comments

Comments
 (0)