Matthias Mullie has uploaded a new change for review.

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

Change subject: Fix (hist) text
......................................................................

Fix (hist) text

This Anchor is not just used in the actions dropdown, it's also used in
Special:RecentChanges & Special:Contributions, where the text should be "hist"
instead of "History".

We should probably cleanup how those anchors are re-used with different texts,
but this should do for now ;)

Change-Id: Ic31d483125630abd66ad2d415dee5811884803d2
---
M includes/Anchor.php
M includes/Formatter/AbstractFormatter.php
2 files changed, 24 insertions(+), 13 deletions(-)


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

diff --git a/includes/Anchor.php b/includes/Anchor.php
index ac70146..3dafe37 100644
--- a/includes/Anchor.php
+++ b/includes/Anchor.php
@@ -42,12 +42,7 @@
                $this->title = $title;
                $this->query = $query;
                $this->fragment = $fragment;
-               if ( $message instanceof Message ) {
-                       $this->message = $message;
-               } else {
-                       // wrap non-messages into a message class
-                       $this->message = new RawMessage( '$1', array( $message 
) );
-               }
+               $this->setMessage( $message );
        }
 
        /**
@@ -108,4 +103,15 @@
                return $title;
        }
 
+       /**
+        * @param Message|string $message Text content of the anchor
+        */
+       public function setMessage( $message ) {
+               if ( $message instanceof Message ) {
+                       $this->message = $message;
+               } else {
+                       // wrap non-messages into a message class
+                       $this->message = new RawMessage( '$1', array( $message 
) );
+               }
+       }
 }
diff --git a/includes/Formatter/AbstractFormatter.php 
b/includes/Formatter/AbstractFormatter.php
index 6e6004f..ff70c78 100644
--- a/includes/Formatter/AbstractFormatter.php
+++ b/includes/Formatter/AbstractFormatter.php
@@ -137,7 +137,7 @@
         *
         * @param array[][] Associative array containing (url, message) tuples
         * @param IContextSource $ctx
-        * @return array|Message
+        * @return Anchor|Message
         */
        protected function getDiffAnchor( array $input, IContextSource $ctx ) {
                if ( !isset( $input['diff'] ) ) {
@@ -155,7 +155,7 @@
         *
         * @param array[][] Associative array containing (url, message) tuples
         * @param IContextSource $ctx
-        * @return array|Message
+        * @return Anchor|Message
         */
        protected function getDiffPrevAnchor( array $input, IContextSource $ctx 
) {
                if ( !isset( $input['diff-prev'] ) ) {
@@ -173,7 +173,7 @@
         *
         * @param array[][] Associative array containing (url, message) tuples
         * @param IContextSource $ctx
-        * @return array|Message
+        * @return Anchor|Message
         */
        protected function getDiffCurAnchor( array $input, IContextSource $ctx 
) {
                if ( !isset( $input['diff-cur'] ) ) {
@@ -191,15 +191,20 @@
         *
         * @param array[][] Associative array containing (url, message) tuples
         * @param IContextSource $ctx
-        * @return array|Message
+        * @return Anchor|Message
         */
        protected function getHistAnchor( array $input, IContextSource $ctx ) {
                if ( isset( $input['post-history'] ) ) {
-                       return $input['post-history'];
+                       $anchor = $input['post-history'];
                } elseif ( isset( $input['topic-history'] ) ) {
-                       return $input['topic-history'];
+                       $anchor = $input['topic-history'];
                } elseif ( isset( $input['board-history'] ) ) {
-                       return $input['board-history'];
+                       $anchor = $input['board-history'];
+               }
+
+               if ( $anchor ) {
+                       $anchor->setMessage( wfMessage( 'hist' ) );
+                       return $anchor;
                } else {
                        // plain text with no link
                        return $ctx->msg( 'hist' );

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

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