EBernhardson has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/101120


Change subject: Only roundtrip through parsoid for wikitext when necessary
......................................................................

Only roundtrip through parsoid for wikitext when necessary

Change-Id: I22597de676965d3fdf927ae3a04bbe3fb44b42ab
---
M includes/Block/Topic.php
1 file changed, 11 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Flow 
refs/changes/20/101120/1

diff --git a/includes/Block/Topic.php b/includes/Block/Topic.php
index 9ed2e3b..0029aaa 100644
--- a/includes/Block/Topic.php
+++ b/includes/Block/Topic.php
@@ -346,7 +346,7 @@
                        $templating->getOutput()->addModules( array( 
'ext.flow.history' ) );
                } else {
                        $templating->getOutput()->addModuleStyles( array( 
'ext.flow.discussion', 'ext.flow.moderation' ) );
-                       $templating->getOutput()->addModules( array( 
'ext.flow.discussion' ) );         
+                       $templating->getOutput()->addModules( array( 
'ext.flow.discussion' ) );
                }
 
                $prefix = '';
@@ -627,7 +627,7 @@
 
                $output = array();
                $output['post-id'] = $post->getPostId()->getHex();
-               $contentFormat = 'wikitext';
+               $contentFormat = null;
 
                if ( isset( $options['contentFormat'] ) ) {
                        $contentFormat = $options['contentFormat'];
@@ -636,10 +636,15 @@
                if ( $post->isModerated() ) {
                        $output['post-moderated'] = 'post-moderated';
                } else {
-                       $output['content'] = array(
-                               '*' => $templating->getContent( $post, 
$contentFormat, $this->user ),
-                               'format' => $contentFormat
-                       );
+                       // This forces a round trip through parsoid for the 
wikitext when
+                       // posts are stored as html, as such it should only be 
used when
+                       // actually needed
+                       if ( $contentFormat !== null ) {
+                               $output['content'] = array(
+                                       '*' => $templating->getContent( $post, 
$contentFormat, $this->user ),
+                                       'format' => $contentFormat
+                               );
+                       }
                        $output['user'] = $post->getCreatorName();
                }
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I22597de676965d3fdf927ae3a04bbe3fb44b42ab
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: master
Gerrit-Owner: EBernhardson <ebernhard...@wikimedia.org>

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

Reply via email to