Jdlrobson has uploaded a new change for review.

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


Change subject: Bug 48485: Stop mobile leaking into Special:Nearby on desktop
......................................................................

Bug 48485: Stop mobile leaking into Special:Nearby on desktop

Shuffle around dependencies.
Init watch star module in initialize function

Change-Id: I0c33637d491ac5d436c30a0a958ea5ecb9b86226
---
M MobileFrontend.php
M includes/specials/SpecialNearby.php
A javascripts/specials/nearby-watchstar.js
M javascripts/specials/nearby.js
4 files changed, 38 insertions(+), 12 deletions(-)


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

diff --git a/MobileFrontend.php b/MobileFrontend.php
index 234b2a3..182c419 100644
--- a/MobileFrontend.php
+++ b/MobileFrontend.php
@@ -301,17 +301,26 @@
        'class' => 'MFResourceLoaderModule',
 );
 
+$wgResourceModules['mobile.beta.common'] = $wgMFMobileResourceBoilerplate + 
array(
+       'dependencies' => array(
+               'mobile.beta.plumbing',
+               'mobile.stable.universal',
+       ),
+       'scripts' => array(
+               'javascripts/common/history-beta.js',
+               'javascripts/views/page.js',
+               'javascripts/common/application-beta.js',
+       ),
+);
+
 $wgResourceModules['mobile.beta'] = $wgMFMobileResourceBoilerplate + array(
        'dependencies' => array(
                'mobile.stable',
-               'mobile.beta.plumbing',
+               'mobile.beta.common',
        ),
        'scripts' => array(
                'javascripts/modules/mf-languages.js',
-               'javascripts/common/history-beta.js',
-               'javascripts/views/page.js',
                'javascripts/modules/mf-toggle-dynamic.js',
-               'javascripts/common/application-beta.js',
        ),
        'position' => 'bottom',
        'messages' => array(
@@ -436,6 +445,7 @@
                'mobile.startup',
                'mobile.stable.dependencies',
                'mobile.notifications',
+               'mediawiki.jqueryMsg',
        ),
        'scripts' => array(
                'javascripts/externals/hogan.js',
@@ -460,7 +470,6 @@
 
 $wgResourceModules['mobile.stable'] = $wgMFMobileResourceBoilerplate + array(
        'dependencies' => array(
-               'mediawiki.jqueryMsg',
                'mobile.startup',
                'mobile.stable.universal',
                'mediawiki.util',
@@ -624,12 +633,21 @@
        ),
 );
 
+$wgResourceModules['mobile.nearby.watchstar'] = $wgMFMobileResourceBoilerplate 
+ array(
+       'dependencies' => array(
+               'mobile.nearby.scripts',
+               'mobile.stable',
+       ),
+       'scripts' => array(
+               'javascripts/specials/nearby-watchstar.js',
+       ),
+);
+
 $wgResourceModules['mobile.nearby.scripts'] = $wgMFMobileResourceBoilerplate + 
array(
        'dependencies' => array(
                'mobile.nearby.plumbing',
-               'mobile.stable',
                'jquery.json',
-               'mobile.beta',
+               'mobile.beta.common',
        ),
        'messages' => array(
                'mobile-frontend-nearby-error',
diff --git a/includes/specials/SpecialNearby.php 
b/includes/specials/SpecialNearby.php
index 3ceeb41..ea774c7 100644
--- a/includes/specials/SpecialNearby.php
+++ b/includes/specials/SpecialNearby.php
@@ -13,6 +13,9 @@
                $ctx = MobileContext::singleton();
                if ( $ctx->shouldDisplayMobileView() && 
$ctx->isBetaGroupMember() ) {
                        $output->addModules( 'mobile.nearby.previews' );
+                       if ( $ctx->isAlphaGroupMember() ) {
+                               $output->addModules( 'mobile.nearby.watchstar' 
);
+                       }
                };
 
                $output->setPageTitle( wfMessage( 
'mobile-frontend-nearby-title' )->escaped() );
diff --git a/javascripts/specials/nearby-watchstar.js 
b/javascripts/specials/nearby-watchstar.js
new file mode 100644
index 0000000..510bac8
--- /dev/null
+++ b/javascripts/specials/nearby-watchstar.js
@@ -0,0 +1,9 @@
+( function( M ) {
+var nearby = M.require( 'nearby' ),
+       watchstar = M.require( 'watchstar' );
+
+nearby.overlay.on( 'postRender', function( $el ) {
+       watchstar.initWatchListIconList( $el.find( 'ul' ) );
+} );
+
+}( mw.mobileFrontend ) );
diff --git a/javascripts/specials/nearby.js b/javascripts/specials/nearby.js
index b38c29c..ac187cc 100644
--- a/javascripts/specials/nearby.js
+++ b/javascripts/specials/nearby.js
@@ -4,7 +4,6 @@
 
 ( function() {
        var supported = M.supportsGeoLocation(),
-               watchstar = M.require( 'watchstar' ),
                popup = M.require( 'notifications' ),
                nav = M.require( 'navigation' ),
                View = M.require( 'view' ),
@@ -13,7 +12,6 @@
                lastKnownLocation = M.settings.getUserSetting( 
CACHE_KEY_LAST_LOCATION ),
                cache = M.settings.saveUserSetting,
                lastSearchResult = M.settings.getUserSetting( CACHE_KEY_RESULTS 
),
-               inAlpha = mw.config.get( 'wgMFMode' ) === 'alpha', // FIXME: 
sandbox before pushing nearby to stable
                Nearby = View.extend( {
                        template: M.template.get( 'articleList' ),
                        initialize: function() {
@@ -23,9 +21,7 @@
                                        $.cookie( 'mwUploadsFunnel', 'nearby', 
{ expires: new Date( new Date().getTime() + 60000) } );
                                        self.emit( 'page-click', ev );
                                } );
-                               if ( inAlpha ) {
-                                       watchstar.initWatchListIconList( 
this.$( 'ul' ) );
-                               }
+                               self.emit( 'postRender', this.$el );
                        }
                } ),
                pendingQuery = false, btn, menu,

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

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