EBernhardson has uploaded a new change for review.

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

Change subject: Limit Flow API to only respond on enabled pages
......................................................................

Limit Flow API to only respond on enabled pages

Bug: 60309
Change-Id: I2b5729bca56d7d98b83388a80459b56af8c19f12
---
M includes/TalkpageManager.php
M includes/api/ApiFlow.php
2 files changed, 10 insertions(+), 2 deletions(-)


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

diff --git a/includes/TalkpageManager.php b/includes/TalkpageManager.php
index 5ff36ee..8fbce71 100644
--- a/includes/TalkpageManager.php
+++ b/includes/TalkpageManager.php
@@ -55,10 +55,14 @@
         * @param Article $article
         */
        public function ensureFlowRevision( \Article $article ) {
+               $title = $article->getTitle();
+               if ( !$this->isTalkpageOccupied( $title ) ) {
+                       throw new InvalidInputException( 'Requested article is 
not Flow enabled', 'invalid-input' );
+               }
+
                // comment to add to the Revision to indicate Flow taking over
                $comment = '/* Taken over by Flow */';
 
-               $title = $article->getTitle();
                $page = $article->getPage();
                $revision = $page->getRevision();
 
diff --git a/includes/api/ApiFlow.php b/includes/api/ApiFlow.php
index 03e0837..bbd3ba8 100644
--- a/includes/api/ApiFlow.php
+++ b/includes/api/ApiFlow.php
@@ -26,7 +26,11 @@
                        ->createWorkflowLoader( $page, $id );
                $occupationController = 
$this->container['occupation_controller'];
                $workflow = $this->loader->getWorkflow();
-               $article = new Article( $workflow->getArticleTitle(), 0 );
+               $title = $workflow->getArticleTitle();
+               $article = new Article( $title, 0 );
+               if ( !$occupationController->isTalkpageOccupied( $title ) ) {
+                       $this->dieUsage( 'The requested article is not Flow 
enabled' );
+               }
 
                // @todo: this is a hack; see ParsoidUtils::convert
                global $wgFlowParsoidTitle;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2b5729bca56d7d98b83388a80459b56af8c19f12
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