Matěj Suchánek has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/357206 )

Change subject: Fix logic in getDiffHistLinks
......................................................................

Fix logic in getDiffHistLinks

Since it's a link to history, it should always have "action=history"
and "curid=". $query argument can stay for other possible params.

Change-Id: I9cae1afa62a714e4a56a5356ba9d6a955c81a5a9
---
M includes/changes/EnhancedChangesList.php
1 file changed, 16 insertions(+), 13 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/06/357206/1

diff --git a/includes/changes/EnhancedChangesList.php 
b/includes/changes/EnhancedChangesList.php
index b34a33f..b5eb6c6 100644
--- a/includes/changes/EnhancedChangesList.php
+++ b/includes/changes/EnhancedChangesList.php
@@ -596,8 +596,6 @@
        protected function recentChangesBlockLine( $rcObj ) {
                $data = [];
 
-               $query['curid'] = $rcObj->mAttribs['rc_cur_id'];
-
                $type = $rcObj->mAttribs['rc_type'];
                $logType = $rcObj->mAttribs['rc_log_type'];
                $classes = $this->getHTMLClasses( $rcObj, $rcObj->watched );
@@ -637,8 +635,7 @@
 
                # Diff and hist links
                if ( $type != RC_LOG && $type != RC_CATEGORIZE ) {
-                       $query['action'] = 'history';
-                       $data['historyLink'] = $this->getDiffHistLinks( $rcObj, 
$query );
+                       $data['historyLink'] = $this->getDiffHistLinks( $rcObj 
);
                }
                $data['separatorAfterLinks'] = ' <span 
class="mw-changeslist-separator">. .</span> ';
 
@@ -660,7 +657,7 @@
                        $data['userTalkLink'] = $rcObj->usertalklink;
                        $data['comment'] = $this->insertComment( $rcObj );
                        if ( $type == RC_CATEGORIZE ) {
-                               $data['historyLink'] = $this->getDiffHistLinks( 
$rcObj, $query );
+                               $data['historyLink'] = $this->getDiffHistLinks( 
$rcObj );
                        }
                        $data['rollback'] = $this->getRollback( $rcObj );
                }
@@ -712,7 +709,7 @@
         * @param array $query array of key/value pairs to append as a query 
string
         * @return string HTML
         */
-       public function getDiffHistLinks( RCCacheEntry $rc, array $query ) {
+       public function getDiffHistLinks( RCCacheEntry $rc, array $query = [] ) 
{
                $pageTitle = $rc->getTitle();
                if ( $rc->getAttribute( 'rc_type' ) == RC_CATEGORIZE ) {
                        // For categorizations we must swap the category title 
with the page title!
@@ -725,13 +722,19 @@
                }
 
                $retVal = ' ' . $this->msg( 'parentheses' )
-                               ->rawParams( $rc->difflink . 
$this->message['pipe-separator']
-                                       . $this->linkRenderer->makeKnownLink(
-                                               $pageTitle,
-                                               new HtmlArmor( 
$this->message['hist'] ),
-                                               [ 'class' => 
'mw-changeslist-history' ],
-                                               $query
-                                       ) )->escaped();
+                       ->rawParams(
+                               $rc->difflink .
+                               $this->message['pipe-separator'] .
+                               $this->linkRenderer->makeKnownLink(
+                                       $pageTitle,
+                                       new HtmlArmor( $this->message['hist'] ),
+                                       [ 'class' => 'mw-changeslist-history' ],
+                                       $query + [
+                                               'action' => 'history',
+                                               'curid' => $rc->getAttribute( 
'rc_cur_id' )
+                                       ]
+                               )
+                       )->escaped();
                return $retVal;
        }
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9cae1afa62a714e4a56a5356ba9d6a955c81a5a9
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Matěj Suchánek <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to