Mattflaschen has uploaded a new change for review.

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

Change subject: Split flow-action-unsupported into two errors, and add real 
messages
......................................................................

Split flow-action-unsupported into two errors, and add real messages

I reproduced flow-action-wrong-title-content-model by creating the
same issue that arose in production (page_content_model set, but
not rev_content_model).

I don't know what would cause flow-action-not-page.

Change-Id: Ib774babe1ced8f623608219d44747f9a6ba32e6c
---
M i18n/en.json
M i18n/qqq.json
M includes/Actions/Action.php
3 files changed, 18 insertions(+), 6 deletions(-)


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

diff --git a/i18n/en.json b/i18n/en.json
index bc22a12..1a2681a 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -637,5 +637,7 @@
        "flow-guidedtour-optin-find-old-conversations": "Find 
{{GENDER:$1|your}} old conversations",
        "flow-guidedtour-optin-find-old-conversations-description": "Previous 
conversations have been moved to an archive page.",
        "flow-guidedtour-optin-feedback": "Give us {{GENDER:$1|your}} 
feedback!",
-       "flow-guidedtour-optin-feedback-description": "{{GENDER:$1|You}} can 
get more information, provide feedback, or disable the new system any time from 
the Beta features section."
+       "flow-guidedtour-optin-feedback-description": "{{GENDER:$1|You}} can 
get more information, provide feedback, or disable the new system any time from 
the Beta features section.",
+       "flow-action-not-page": "Page object is the wrong class",
+       "flow-action-wrong-title-content-model": "The page is being handled by 
Flow, but the Title class indicates that the content model is '$1'.  This is a 
misconfiguration or inconsistent state.  For example, this may actually be a 
non-Flow page in a Flow namespace, with rev_content_model not populated."
 }
diff --git a/i18n/qqq.json b/i18n/qqq.json
index 31a41d6..2f545ac 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -647,5 +647,7 @@
        "flow-guidedtour-optin-find-old-conversations": "Title of the 'find old 
conversations' step in the flow opt-in guided tour that launches after the user 
chose to convert their talk page to a Flow board. This message appears next to 
the board description, where a link is visible to the user's old talk page.",
        "flow-guidedtour-optin-find-old-conversations-description": 
"Description of the 'find old conversations' step in the flow opt-in guided 
tour that launches after the user chose to convert their talk page to a Flow 
board. This message appears next to the board description, where a link is 
visible to the user's old talk page.",
        "flow-guidedtour-optin-feedback": "Title of the 'feedback' step in the 
flow opt-in guided tour that launches after the user chose to convert their 
talk page to a Flow board. It appears under the 'beta' personal tool link, 
suggesting to the users that they can send the Flow developers feedback on 
their experience.",
-       "flow-guidedtour-optin-feedback-description": "Description of the 
'feedback' step in the flow opt-in guided tour that launches after the user 
chose to convert their talk page to a Flow board. It appears under the 'beta' 
personal tool link, suggesting to the users that they can send the Flow 
developers feedback on their experience."
+       "flow-guidedtour-optin-feedback-description": "Description of the 
'feedback' step in the flow opt-in guided tour that launches after the user 
chose to convert their talk page to a Flow board. It appears under the 'beta' 
personal tool link, suggesting to the users that they can send the Flow 
developers feedback on their experience.",
+       "flow-action-not-page": "Error displayed in the main page area if a bug 
or misconfiguration causes inconsistent state",
+       "flow-action-wrong-title-content-model": "Error displayed if the page 
has the wrong content model.  Parameters:\n* $1 - The actual content model as 
reported by the Title class"
 }
diff --git a/includes/Actions/Action.php b/includes/Actions/Action.php
index 95625d4..516fca8 100644
--- a/includes/Actions/Action.php
+++ b/includes/Actions/Action.php
@@ -59,14 +59,22 @@
                        $output = $this->context->getOutput();
                }
 
-               // Check if this is actually a Flow page.
+               // Check if this is actually the right type of page.
                if ( ! $this->page instanceof WikiPage && ! $this->page 
instanceof Article ) {
-                       throw new ErrorPageError( 'nosuchaction', 
'flow-action-unsupported' );
+                       throw new ErrorPageError( 'nosuchaction', 
'flow-action-not-page' );
                }
 
                $title = $this->page->getTitle();
-               if ( $title->getContentModel() !== CONTENT_MODEL_FLOW_BOARD ) {
-                       throw new ErrorPageError( 'nosuchaction', 
'flow-action-unsupported' );
+
+               $titleContentModel = $title->getContentModel();
+               if ( $titleContentModel !== CONTENT_MODEL_FLOW_BOARD ) {
+                       // If we make it to this method, something thinks it's 
Flow.
+                       // However, if we get here the Title class thinks 
otherwise.
+
+                       // This may mean it is a non-Flow page in a Flow 
namespace, if
+                       // page_content_model is populated but 
rev_content_model is not.
+
+                       throw new ErrorPageError( 'nosuchaction', 
'flow-action-wrong-title-content-model', $titleContentModel );
                }
 
                // @todo much of this seems to duplicate 
BoardContent::getParserOutput

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib774babe1ced8f623608219d44747f9a6ba32e6c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: master
Gerrit-Owner: Mattflaschen <mflasc...@wikimedia.org>

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

Reply via email to