Werdna has uploaded a new change for review.

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


Change subject: Fix bug 54936: Redirect most references to Special:Flow through 
UrlGenerator
......................................................................

Fix bug 54936: Redirect most references to Special:Flow through UrlGenerator

Change-Id: Ib175463483a1a8168b49235538c342809ceb82b6
---
M includes/Model/Workflow.php
M includes/Notifications/Controller.php
M includes/Notifications/Formatter.php
M includes/Templating.php
M includes/UrlGenerator.php
5 files changed, 6 insertions(+), 19 deletions(-)


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

diff --git a/includes/Model/Workflow.php b/includes/Model/Workflow.php
index e1d79c1..f7b4767 100644
--- a/includes/Model/Workflow.php
+++ b/includes/Model/Workflow.php
@@ -3,7 +3,6 @@
 namespace Flow\Model;
 
 use MWTimestamp;
-use SpecialPage;
 use Title;
 use User;
 
@@ -84,11 +83,6 @@
                $obj->updateLastModified();
 
                return $obj;
-       }
-
-       public function getTitle() {
-               $article = $this->getArticleTitle();
-               return SpecialPage::getTitleFor( 'Flow', 
$article->getPrefixedDBkey() );
        }
 
        public function getArticleTitle() {
diff --git a/includes/Notifications/Controller.php 
b/includes/Notifications/Controller.php
index fcc614b..d51a832 100644
--- a/includes/Notifications/Controller.php
+++ b/includes/Notifications/Controller.php
@@ -275,7 +275,7 @@
        protected function getMentionedUsersFromWikitext( $wikitext ) {
                global $wgParser;
 
-               $title = \SpecialPage::getTitleFor( 'Flow' );
+               $title = \SpecialPage::getTitleFor( 'Flow' ); // Bogus title 
used for parser
 
                $options = new \ParserOptions;
                $options->setTidy( true );
diff --git a/includes/Notifications/Formatter.php 
b/includes/Notifications/Formatter.php
index 25d7ebe..b24a514 100644
--- a/includes/Notifications/Formatter.php
+++ b/includes/Notifications/Formatter.php
@@ -5,8 +5,6 @@
 use Flow\Container;
 use Flow\UrlGenerator;
 use EchoBasicFormatter;
-use Special;
-use SpecialPage;
 
 // could be renamed later if we have more formatters
 class NotificationFormatter extends EchoBasicFormatter {
@@ -14,12 +12,7 @@
 
        protected function processParam( $event, $param, $message, $user ) {
                $extra = $event->getExtra();
-               if ( $param === 'flow-board' ) {
-                       $title = $event->getTitle();
-                       $boardTitle = Special::getTitleFor( 'Flow', 
$title->getPrefixedText() );
-                       $output = $this->formatTitle( $boardTitle );
-                       $message->params( $output );
-               } elseif ( $param === 'subject' ) {
+               if ( $param === 'subject' ) {
                        if ( isset( $extra['topic-title'] ) && 
$extra['topic-title'] ) {
                                $message->params( trim($extra['topic-title']) );
                        } else {
@@ -60,8 +53,9 @@
 
                        $message->params( $url );
                } elseif ( $param == 'flow-title' ) {
-                       $title = $this->formatTitle( SpecialPage::getTitleFor( 
'Flow', $event->getTitle() ) );
-                       $message->params( $title );
+                       list( $title ) = 
$this->getUrlGenerator()->buildUrlData( $event->getTitle() );
+                       $formatted = $this->formatTitle( $title );
+                       $message->params( $formatted );
                } elseif ( $param == 'old-subject' ) {
                        $message->params( trim($extra['old-subject']) );
                } elseif ( $param == 'new-subject' ) {
diff --git a/includes/Templating.php b/includes/Templating.php
index b254c3a..c9d72ac 100644
--- a/includes/Templating.php
+++ b/includes/Templating.php
@@ -13,7 +13,6 @@
 use Linker;
 use MWTimestamp;
 use RequestContext;
-use SpecialPage;
 use Title;
 use User;
 use Flow\View\PostActionMenu;
diff --git a/includes/UrlGenerator.php b/includes/UrlGenerator.php
index 2000057..2295650 100644
--- a/includes/UrlGenerator.php
+++ b/includes/UrlGenerator.php
@@ -83,7 +83,7 @@
                        // Only way to know what title the workflow points at
                        $workflow = $this->storage->get( $workflowId );
                        if ( !$workflow ) {
-                               throw new \MWException( "Unknown flow object: 
$workflowId" );
+                               return array( SpecialPage::getTitleFor( 'Flow' 
), 'missing=true' );
                        }
                }
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib175463483a1a8168b49235538c342809ceb82b6
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: master
Gerrit-Owner: Werdna <agarr...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot

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

Reply via email to