Matthias Mullie has uploaded a new change for review.

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

Change subject: Fix toggling Flow to false in BetaFeatures (opt-out)
......................................................................

Fix toggling Flow to false in BetaFeatures (opt-out)

The problem seems to have been that when opting in, the
workflow was associated with the page we just moved out
of the way instead of with the new page.
As a result, when trying to opt-out, it couldn't locate
the workflow associated with the board, because it was
tied to the wrong page to begin with.

Bug: T111830
Change-Id: Ic30ebdf1681bd8bd1b313e4a5ea738f03fee01ea
---
M Hooks.php
M includes/Import/OptInController.php
2 files changed, 9 insertions(+), 1 deletion(-)


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

diff --git a/Hooks.php b/Hooks.php
index 75b756f..8edbb3b 100644
--- a/Hooks.php
+++ b/Hooks.php
@@ -1566,7 +1566,7 @@
        }
 
        /**
-        * Occurs at the begining of the MovePage process. Perhaps ContentModel 
should be
+        * Occurs at the beginning of the MovePage process. Perhaps 
ContentModel should be
         * extended to be notified about moves explicitly.
         */
        public static function onTitleMove( Title $oldTitle, Title $newTitle, 
User $user ) {
diff --git a/includes/Import/OptInController.php 
b/includes/Import/OptInController.php
index 0a498f7..b55514a 100644
--- a/includes/Import/OptInController.php
+++ b/includes/Import/OptInController.php
@@ -236,6 +236,14 @@
                        $this->fatal( 
'flow-special-enableflow-board-creation-not-allowed', $page );
                }
 
+               // $title was recently moved, but the article ID is cached 
inside
+               // the Title object. Let's make sure it accurately reflects that
+               // $title now doesn't exist by forcefully re-fetching the non-
+               // existing article ID.
+               // Otherwise, we run the risk of the Workflow we're creating 
being
+               // associated with the page we just moved.
+               $title->getArticleID( Title::GAID_FOR_UPDATE );
+
                $loader = $loaderFactory->createWorkflowLoader( $title );
                $blocks = $loader->getBlocks();
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic30ebdf1681bd8bd1b313e4a5ea738f03fee01ea
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: master
Gerrit-Owner: Matthias Mullie <mmul...@wikimedia.org>

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

Reply via email to