Thcipriani has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/372465 )

Change subject: Restore the newFromId() approach in 
SpecialNewpages::feedItemDesc
......................................................................

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
---
M includes/specials/SpecialNewpages.php
1 file changed, 14 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/65/372465/1

diff --git a/includes/specials/SpecialNewpages.php 
b/includes/specials/SpecialNewpages.php
index 6a79714..e3b73a9 100644
--- a/includes/specials/SpecialNewpages.php
+++ b/includes/specials/SpecialNewpages.php
@@ -494,17 +494,22 @@
        }
 
        protected function feedItemDesc( $row ) {
-               $revision = $this->revisionFromRcResult( $row );
-               if ( $revision ) {
-                       // XXX: include content model/type in feed item?
-                       return '<p>' . htmlspecialchars( 
$revision->getUserText() ) .
-                               $this->msg( 'colon-separator' 
)->inContentLanguage()->escaped() .
-                               htmlspecialchars( FeedItem::stripComment( 
$revision->getComment() ) ) .
-                               "</p>\n<hr />\n<div>" .
-                               nl2br( htmlspecialchars( 
$revision->getContent()->serialize() ) ) . "</div>";
+               $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 '<p>' . htmlspecialchars( $revision->getUserText() ) .
+                       $this->msg( 'colon-separator' 
)->inContentLanguage()->escaped() .
+                       htmlspecialchars( FeedItem::stripComment( 
$revision->getComment() ) ) .
+                       "</p>\n<hr />\n<div>" .
+                       nl2br( htmlspecialchars( $content->serialize() ) ) . 
"</div>";
        }
 
        protected function getGroupName() {

-- 
To view, visit https://gerrit.wikimedia.org/r/372465
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2213675d3392c6e9761bdc7acde35fd1caee4517
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: wmf/1.30.0-wmf.14
Gerrit-Owner: Thcipriani <tcipri...@wikimedia.org>
Gerrit-Reviewer: Aaron Schulz <asch...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to