Merge "Remove use of implicitGroupby() in WikiPage"
[lhc/web/wiklou.git] / includes / specials / SpecialNewpages.php
index 6a79714..671ab6f 100644 (file)
@@ -278,28 +278,23 @@ class SpecialNewpages extends IncludableSpecialPage {
                        }
                );
                $htmlForm->setMethod( 'get' );
-
-               $out->addHTML( Xml::fieldset( $this->msg( 'newpages' )->text() ) );
-
+               $htmlForm->setWrapperLegend( true );
+               $htmlForm->setWrapperLegendMsg( 'newpages' );
+               $htmlForm->addFooterText( Html::rawElement(
+                       'div',
+                       null,
+                       $this->filterLinks()
+               ) );
                $htmlForm->show();
-
-               $out->addHTML(
-                       Html::rawElement(
-                               'div',
-                               null,
-                               $this->filterLinks()
-                       ) .
-                       Xml::closeElement( 'fieldset' )
-               );
        }
 
        /**
-        * @param stdClass $row Result row from recent changes
+        * @param stdClass $result Result row from recent changes
         * @return Revision|bool
         */
        protected function revisionFromRcResult( stdClass $result ) {
                return new Revision( [
-                       'comment' => $result->rc_comment,
+                       'comment' => CommentStore::newKey( 'rc_comment' )->getComment( $result )->text,
                        'deleted' => $result->rc_deleted,
                        'user_text' => $result->rc_user_text,
                        'user' => $result->rc_user,
@@ -391,10 +386,6 @@ class SpecialNewpages extends IncludableSpecialPage {
                $oldTitleText = '';
                $oldTitle = Title::makeTitle( $result->rc_namespace, $result->rc_title );
 
-               if ( count( $classes ) ) {
-                       $attribs['class'] = implode( ' ', $classes );
-               }
-
                if ( !$title->equals( $oldTitle ) ) {
                        $oldTitleText = $oldTitle->getPrefixedText();
                        $oldTitleText = Html::rawElement(
@@ -411,6 +402,10 @@ class SpecialNewpages extends IncludableSpecialPage {
                Hooks::run( 'NewPagesLineEnding', [ $this, &$ret, $result, &$classes, &$attribs ] );
                $attribs = wfArrayFilterByKey( $attribs, [ Sanitizer::class, 'isReservedDataAttribute' ] );
 
+               if ( count( $classes ) ) {
+                       $attribs['class'] = implode( ' ', $classes );
+               }
+
                return Html::rawElement( 'li', $attribs, $ret ) . "\n";
        }
 
@@ -494,17 +489,22 @@ class SpecialNewpages extends IncludableSpecialPage {
        }
 
        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 '';
+               }
+
+               $content = $revision->getContent();
+               if ( $content === null ) {
+                       return '';
                }
 
-               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() {