Fix backlink for RevertAction
authorumherirrender <umherirrender_de.wp@web.de>
Sun, 3 Aug 2014 20:04:45 +0000 (22:04 +0200)
committerKrinkle <krinklemail@gmail.com>
Fri, 5 Dec 2014 14:28:18 +0000 (14:28 +0000)
RevertAction::getDescription cannot set subtitle on OutputPage,
because the subtitle on OutputPage gets cleared before the
result of getDescription is added and than the subtitle is gone.

Refactored the code for building the backlink into a static function
and use it.

Change-Id: Iedad0b8e040035a9a10a0b140d2322357e6b539a

includes/OutputPage.php
includes/actions/RevertAction.php

index fb2d6f4..3294884 100644 (file)
@@ -1033,17 +1033,29 @@ class OutputPage extends ContextSource {
        }
 
        /**
-        * Add a subtitle containing a backlink to a page
+        * Build message object for a subtitle containing a backlink to a page
         *
         * @param Title $title Title to link to
         * @param array $query Array of additional parameters to include in the link
+        * @return Message
+        * @since 1.25
         */
-       public function addBacklinkSubtitle( Title $title, $query = array() ) {
+       public static function buildBacklinkSubtitle( Title $title, $query = array() ) {
                if ( $title->isRedirect() ) {
                        $query['redirect'] = 'no';
                }
-               $this->addSubtitle( $this->msg( 'backlinksubtitle' )
-                       ->rawParams( Linker::link( $title, null, array(), $query ) ) );
+               return wfMessage( 'backlinksubtitle' )
+                       ->rawParams( Linker::link( $title, null, array(), $query ) );
+       }
+
+       /**
+        * Add a subtitle containing a backlink to a page
+        *
+        * @param Title $title Title to link to
+        * @param array $query Array of additional parameters to include in the link
+        */
+       public function addBacklinkSubtitle( Title $title, $query = array() ) {
+               $this->addSubtitle( self::buildBacklinkSubtitle( $title, $query ) );
        }
 
        /**
index 6481630..d025878 100644 (file)
@@ -144,8 +144,6 @@ class RevertAction extends FormAction {
        }
 
        protected function getDescription() {
-               $this->getOutput()->addBacklinkSubtitle( $this->getTitle() );
-
-               return '';
+               return OutputPage::buildBacklinkSubtitle( $this->getTitle() );
        }
 }