Jdlrobson has uploaded a new change for review.

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


Change subject: Bug 51458: Allow watching outside main namespace
......................................................................

Bug 51458: Allow watching outside main namespace

Bug: 51458
Change-Id: Ie855c05bda0fe0a44767874b32d003e8c6928729
---
M includes/skins/SkinMinerva.php
M javascripts/modules/mf-watchstar.js
2 files changed, 11 insertions(+), 14 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend 
refs/changes/70/74070/1

diff --git a/includes/skins/SkinMinerva.php b/includes/skins/SkinMinerva.php
index 8893bb5..09e6a71 100644
--- a/includes/skins/SkinMinerva.php
+++ b/includes/skins/SkinMinerva.php
@@ -108,7 +108,7 @@
                );
                if ( !$user->isAnon() ) {
                        $vars['wgWatchedPageCache'] = array(
-                               $title->getText() => $user->isWatched( $title ),
+                               $title->getPrefixedDBkey() => $user->isWatched( 
$title ),
                        );
                }
                $ctx = MobileContext::singleton();
diff --git a/javascripts/modules/mf-watchstar.js 
b/javascripts/modules/mf-watchstar.js
index 4089352..82c06bc 100644
--- a/javascripts/modules/mf-watchstar.js
+++ b/javascripts/modules/mf-watchstar.js
@@ -1,4 +1,5 @@
-(function( M, $ ) {
+// FIXME: This needs a big rewrite
+( function( M, $ ) {
 
 var api = M.require( 'api' ), w = ( function() {
        var popup = M.require( 'notifications' ),
@@ -226,26 +227,22 @@
        if ( !$( '#ca-watch' ).length ) {
                $( '<li id="ca-watch">' ).appendTo( '#mw-mf-menu-page' );
        }
-       function init( $container, title ) {
-               var pageTitle = mw.config.get( 'wgTitle' ),
-                       isSpecialPage = mw.config.get( 'wgNamespaceNumber' ) 
=== mw.config.get( 'wgNamespaceIds' ).special;
-               $container = $container || $( '#ca-watch' ).removeClass( 
'watched watch-this-article' ).empty();
-               title = title || pageTitle;
+       function init( page ) {
+               var isSpecialPage = mw.config.get( 'wgNamespaceNumber' ) === 
mw.config.get( 'wgNamespaceIds' ).special,
+                       $container = $container || $( '#ca-watch' 
).removeClass( 'watched watch-this-article' ).empty();
                // initialise on current page
-               if ( $container && !isSpecialPage ) {
-                       initWatchListIcon( $container, title );
+               if ( !isSpecialPage ) {
+                       initWatchListIcon( $container, page.title );
                }
-
                upgradeUI();
        }
 
        // bind to future page loads
-       M.on( 'page-loaded', function( article ) {
-               initWatchListIcon( $( '#ca-watch' ), article.title );
-       } );
+       M.on( 'page-loaded', init );
+
+       init( { title: mw.config.get( 'wgPageName' ) } );
 
        return {
-               init: init,
                initWatchListIcon: initWatchListIcon,
                initWatchListIconList: initWatchListIconList
        };

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie855c05bda0fe0a44767874b32d003e8c6928729
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Jdlrobson <[email protected]>

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

Reply via email to