jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/350326 )

Change subject: Recover lost fix for redirect bug
......................................................................


Recover lost fix for redirect bug

Bug: T149250
Change-Id: I9060af0d1369c94e212329b7a2e4ef3ba6a94394
---
M i18n/en.json
M src/Hook.php
2 files changed, 7 insertions(+), 3 deletions(-)

Approvals:
  jenkins-bot: Verified
  MarkAHershberger: Looks good to me, approved



diff --git a/i18n/en.json b/i18n/en.json
index 7e51951..f554ddb 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -12,7 +12,7 @@
        "specialwhoiswatchingusage": "This special page cannot be used on its 
own.",
        "specialwhoiswatchingaddusers": "Add users to watch the page",
        "specialwhoiswatchingaddbtn": "Add selected users",
-       "whoiswatching_users_pageview": 
"[{{fullurl:Special:WhoIsWatching/{{FULLPAGENAMEE}}}} $1] watching 
{{PLURAL:$1|user|users}}",
+       "whoiswatching_users_pageview": "[{{fullurl:Special:WhoIsWatching/$2}} 
$1] watching {{PLURAL:$1|user|users}}",
        "whoiswatching-not-possible-title": "Impossible page to watch",
        "whoiswatching-not-possible": "It is not possible to watch the [[$1]] 
page.",
        "whoiswatching-usage-title": "How to use this page",
diff --git a/src/Hook.php b/src/Hook.php
index fd13fc9..4fd62cf 100644
--- a/src/Hook.php
+++ b/src/Hook.php
@@ -36,6 +36,10 @@
                $conf = new GlobalVarConfig( "whoiswatching_" );
                $showIfZero = $conf->get( "showifzero" );
                $title = $template->getTitle();
+               if ( $title->isRedirect() ) {
+                       $article = Article::newFromID( $title->getArticleID() );
+                       $title = $article->getRedirectTarget();
+               }
                $user = $template->getUser();
                $showWatchingUsers = $conf->get( "showwatchingusers" )
                                                   || $user->isAllowed( 
'seepagewatchers' );
@@ -48,9 +52,9 @@
                        ], __METHOD__ );
                        $watch = $dbr->fetchObject( $res );
                        if ( $watch->count > 0 || $showIfZero ) {
+                               $lang = 
RequestContext::getMain()->getLanguage();
                                $msg = wfMessage( 
'whoiswatching_users_pageview',
-                                       
RequestContext::getMain()->getLanguage()->formatNum
-                                                                 ( 
$watch->count )
+                                                                 
$lang->formatNum( $watch->count ), $title
                                )->parse();
                                $tpl->set( 'numberofwatchingusers', $msg );
                        }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I9060af0d1369c94e212329b7a2e4ef3ba6a94394
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WhoIsWatching
Gerrit-Branch: master
Gerrit-Owner: MarkAHershberger <m...@nichework.com>
Gerrit-Reviewer: MarkAHershberger <m...@nichework.com>
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