jenkins-bot has submitted this change and it was merged.

Change subject: Remove title must exist requirement
......................................................................


Remove title must exist requirement

At one point parsoid required a page title to exist to
convert back and forth.  That requirement no longer exists
and we shouldn't enforce it.

Bug: 61873
Change-Id: I6fa29c3201cd694746666c168438b83c6bca559b
---
M FlowActions.php
M includes/Block/Header.php
M includes/Block/TopicList.php
M includes/Parsoid/Utils.php
M includes/api/ApiParsoidUtilsFlow.php
5 files changed, 1 insertion(+), 31 deletions(-)

Approvals:
  Matthias Mullie: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/FlowActions.php b/FlowActions.php
index a2c865e..fdb1740 100644
--- a/FlowActions.php
+++ b/FlowActions.php
@@ -466,7 +466,7 @@
                                if ( $revision->getChangeType() == 
'restore-post' ) {
                                        $previous = 
$collection->getPrevRevision( $revision );
 
-                                       if ( $previous->getModerationState() 
=== AbstractRevision::MODERATED_NONE ) {
+                                       if ( $previous === null || 
$previous->getModerationState() === AbstractRevision::MODERATED_NONE ) {
                                                return '';
                                        }
 
diff --git a/includes/Block/Header.php b/includes/Block/Header.php
index 36c80c4..8e542e6 100644
--- a/includes/Block/Header.php
+++ b/includes/Block/Header.php
@@ -6,7 +6,6 @@
 use Flow\Exception\InvalidActionException;
 use Flow\Exception\InvalidInputException;
 use Flow\Model\Header;
-use Flow\OccupationController;
 use Flow\RevisionActionPermissions;
 use Flow\Templating;
 use Flow\View\HeaderRevisionView;
@@ -121,14 +120,6 @@
                        // is this even worth checking?
                        $this->addError( 'prev_revision', wfMessage( 
'flow-error-prev-revision-does-not-exist' ) );
                        return;
-               }
-
-               $title = $this->workflow->getArticleTitle();
-               if ( !$title->exists() ) {
-                       // if $wgFlowContentFormat is set to html the 
Header::create
-                       // call will convert the wikitext input into html via 
parsoid, and
-                       // parsoid requires the page exist.
-                       Container::get( 'occupation_controller' 
)->ensureFlowRevision( new \Article( $title, 0 ) );
                }
 
                $this->header = Header::create( $this->workflow, $this->user, 
$this->submitted['content'], 'create-header' );
diff --git a/includes/Block/TopicList.php b/includes/Block/TopicList.php
index 3c8a6dc..1321cd5 100644
--- a/includes/Block/TopicList.php
+++ b/includes/Block/TopicList.php
@@ -12,7 +12,6 @@
 use Flow\Model\UUID;
 use Flow\Model\Workflow;
 use Flow\NotificationController;
-use Flow\OccupationController;
 use Flow\RevisionActionPermissions;
 use Flow\Templating;
 use Flow\Exception\FailCommitException;
@@ -127,15 +126,6 @@
                $title = $this->workflow->getArticleTitle();
                $topicWorkflow = Workflow::create( $topicDef, $this->user, 
$title );
                $topicListEntry = TopicListEntry::create( $this->workflow, 
$topicWorkflow );
-
-               if ( !$title->exists() ) {
-                       // if $wgFlowContentFormat is set to html the 
PostRevision::create
-                       // call will convert the wikitext input into html via 
parsoid, and
-                       // parsoid requires the page exist.
-                       /** @var OccupationController $occupationController */
-                       $occupationController = Container::get( 
'occupation_controller' );
-                       $occupationController->ensureFlowRevision( new 
\Article( $title, 0 ) );
-               }
                $topicPost = PostRevision::create( $topicWorkflow, 
$this->submitted['topic'] );
 
                $firstPost = null;
diff --git a/includes/Parsoid/Utils.php b/includes/Parsoid/Utils.php
index c78f3a9..f3ccb47 100644
--- a/includes/Parsoid/Utils.php
+++ b/includes/Parsoid/Utils.php
@@ -24,11 +24,6 @@
 
                $section = new \ProfileSection( __METHOD__ );
 
-               // Parsoid will fail if title does not exist
-               if ( !$title->exists() ) {
-                       throw new InvalidDataException( 'Title "' . 
$title->getPrefixedDBkey() . '" does not exist.', 'invalid-title' );
-               }
-
                try {
                        // use VE API (which connects to Parsoid) if 
available...
                        $res = self::parsoid( $from, $to, $content, $title );
diff --git a/includes/api/ApiParsoidUtilsFlow.php 
b/includes/api/ApiParsoidUtilsFlow.php
index 1868446..2d48f31 100644
--- a/includes/api/ApiParsoidUtilsFlow.php
+++ b/includes/api/ApiParsoidUtilsFlow.php
@@ -11,12 +11,6 @@
                $params = $this->extractRequestParams();
                $page = $this->getTitleOrPageId( $params );
 
-               if ( !$page->exists() ) {
-                       // Parsoid\Utils::convert checks for this, but we can 
provide
-                       // a nicer error here
-                       $this->dieUsage( 'Page does not exist', 'invalid-title' 
);
-               }
-
                try {
                        $content = Utils::convert( $params['from'], 
$params['to'], $params['content'], $page->getTitle() );
                } catch ( WikitextException $e ) {

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I6fa29c3201cd694746666c168438b83c6bca559b
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: master
Gerrit-Owner: EBernhardson <[email protected]>
Gerrit-Reviewer: Jdlrobson <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: Matthias Mullie <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to