X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiFeedContributions.php;h=9edf929f8eaf2f4cf5982cb56c5adddd08078e10;hb=b9333ae6557b86e4b074025c43e77e745610b345;hp=2b2b32c1bedbb0987fc2762d5ff5f55aab440b66;hpb=9cd8d3e2d7ef3bbbddf2665a5b1eb8f637c16fc6;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiFeedContributions.php b/includes/api/ApiFeedContributions.php index 2b2b32c1be..9edf929f8e 100644 --- a/includes/api/ApiFeedContributions.php +++ b/includes/api/ApiFeedContributions.php @@ -21,10 +21,10 @@ */ use MediaWiki\MediaWikiServices; -use MediaWiki\Storage\RevisionAccessException; -use MediaWiki\Storage\RevisionRecord; -use MediaWiki\Storage\RevisionStore; -use MediaWiki\Storage\SlotRecord; +use MediaWiki\Revision\RevisionAccessException; +use MediaWiki\Revision\RevisionRecord; +use MediaWiki\Revision\RevisionStore; +use MediaWiki\Revision\SlotRecord; /** * @ingroup API @@ -172,33 +172,29 @@ class ApiFeedContributions extends ApiBase { * @return string */ protected function feedItemDesc( RevisionRecord $revision ) { - if ( $revision ) { - $msg = wfMessage( 'colon-separator' )->inContentLanguage()->text(); - try { - $content = $revision->getContent( SlotRecord::MAIN ); - } catch ( RevisionAccessException $e ) { - $content = null; - } - - if ( $content instanceof TextContent ) { - // only textual content has a "source view". - $html = nl2br( htmlspecialchars( $content->getNativeData() ) ); - } else { - // XXX: we could get an HTML representation of the content via getParserOutput, but that may - // contain JS magic and generally may not be suitable for inclusion in a feed. - // Perhaps Content should have a getDescriptiveHtml method and/or a getSourceText method. - // Compare also FeedUtils::formatDiffRow. - $html = ''; - } - - $comment = $revision->getComment(); + $msg = wfMessage( 'colon-separator' )->inContentLanguage()->text(); + try { + $content = $revision->getContent( SlotRecord::MAIN ); + } catch ( RevisionAccessException $e ) { + $content = null; + } - return '

' . htmlspecialchars( $this->feedItemAuthor( $revision ) ) . $msg . - htmlspecialchars( FeedItem::stripComment( $comment ? $comment->text : '' ) ) . - "

\n
\n
" . $html . '
'; + if ( $content instanceof TextContent ) { + // only textual content has a "source view". + $html = nl2br( htmlspecialchars( $content->getNativeData() ) ); + } else { + // XXX: we could get an HTML representation of the content via getParserOutput, but that may + // contain JS magic and generally may not be suitable for inclusion in a feed. + // Perhaps Content should have a getDescriptiveHtml method and/or a getSourceText method. + // Compare also FeedUtils::formatDiffRow. + $html = ''; } - return ''; + $comment = $revision->getComment(); + + return '

' . htmlspecialchars( $this->feedItemAuthor( $revision ) ) . $msg . + htmlspecialchars( FeedItem::stripComment( $comment ? $comment->text : '' ) ) . + "

\n
\n
" . $html . '
'; } public function getAllowedParams() {