Matthias Mullie has uploaded a new change for review.

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

Change subject: (bug 70148) Fix new topic creation with wikitext storage
......................................................................

(bug 70148) Fix new topic creation with wikitext storage

Bug: 70148
Change-Id: Ief9062b8f2bd77a1071c4f839e8b6865c03f102d
---
M Flow.php
M includes/Model/AbstractRevision.php
2 files changed, 14 insertions(+), 2 deletions(-)


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

diff --git a/Flow.php b/Flow.php
index f126d64..bef9af6 100644
--- a/Flow.php
+++ b/Flow.php
@@ -155,7 +155,7 @@
 // running, as it'll be necessary to convert HTML to wikitext for the basic 
editor.
 // (n.b. to use VisualEditor, you'll definitely need Parsoid, so if you do 
support VE,
 // might as well set this to HTML right away)
-$wgFlowContentFormat = 'html'; // possible values: html|wikitext XXX bug 70148 
with wikitext
+$wgFlowContentFormat = 'wikitext'; // possible values: html|wikitext
 
 // Flow Parsoid config
 // If null, VE's defaults (if available) will be used
diff --git a/includes/Model/AbstractRevision.php 
b/includes/Model/AbstractRevision.php
index 4620f8e..ccdda34 100644
--- a/includes/Model/AbstractRevision.php
+++ b/includes/Model/AbstractRevision.php
@@ -4,6 +4,7 @@
 
 use Flow\Collection\AbstractCollection;
 use Flow\Exception\DataModelException;
+use Flow\Exception\InvalidDataException;
 use Flow\Exception\PermissionException;
 use Flow\Parsoid\Utils;
 use Title;
@@ -334,11 +335,22 @@
                        if ( $sourceFormat === $format ) {
                                $this->convertedContent[$format] = $raw;
                        } else {
+                               try {
+                                       $title = 
$this->getCollection()->getTitle();
+                               } catch ( InvalidDataException $e ) {
+                                       // When creating a new topic, 
ReferenceRecorder will call
+                                       // this method (for the initial post), 
but workflow is only
+                                       // inserted after the post is, so the 
workflow (required to
+                                       // get the associated Title) does not 
yet exist. This hacks
+                                       // around it by just creating title 
object ourselves.
+                                       $title = Title::newFromText( 
$this->getCollection()->getWorkflowId()->getAlphadecimal(), NS_TOPIC );
+                               }
+
                                $this->convertedContent[$format] = 
Utils::convert(
                                        $sourceFormat,
                                        $format,
                                        $raw,
-                                       $this->getCollection()->getTitle()
+                                       $title
                                );
                        }
                }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ief9062b8f2bd77a1071c4f839e8b6865c03f102d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: master
Gerrit-Owner: Matthias Mullie <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to