jenkins-bot has submitted this change and it was merged.

Change subject: Only init watchstar on a non special page
......................................................................


Only init watchstar on a non special page

Bug: T93738
Change-Id: I2cf1d4c0e1b99331220693a79d1a9923fce96d19
---
M resources/ext.gather.watchstar/init.js
1 file changed, 15 insertions(+), 13 deletions(-)

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



diff --git a/resources/ext.gather.watchstar/init.js 
b/resources/ext.gather.watchstar/init.js
index 21891c6..2197a2b 100644
--- a/resources/ext.gather.watchstar/init.js
+++ b/resources/ext.gather.watchstar/init.js
@@ -5,7 +5,8 @@
                WatchstarPageActionOverlay = M.require( 
'ext.gather.watchstar/WatchstarPageActionOverlay' ),
                settings = M.require( 'settings' ),
                settingOverlayWasDismissed = 'gather-has-dismissed-tutorial',
-               user = M.require( 'user' );
+               user = M.require( 'user' ),
+               page = M.getCurrentPage();
 
        /**
         * Determines if collection tutorial should be shown
@@ -78,8 +79,8 @@
         * @ignore
         */
        function init( page ) {
-               var shouldShow = shouldShowCollectionTutorial(),
-                       $star = $( '#ca-watch' ),
+               var $star = $( '#ca-watch' ),
+                       shouldShow = shouldShowCollectionTutorial(),
                        watchstar = new CollectionsWatchstar( {
                                el: $star,
                                page: page,
@@ -88,17 +89,18 @@
                                collections: mw.config.get( 
'wgGatherCollections' ),
                                isNewlyAuthenticatedUser: 
mw.util.getParamValue( 'article_action' ) === 'add_to_collection'
                        } );
-               if ( !page.inNamespace( 'special' ) ) {
-                       // Determine if we should show the collection tutorial
-                       if ( $star.length > 0 && shouldShow ) {
-                               // FIXME: Timeout shouldn't be necessary but 
T91047 exists.
-                               setTimeout( function () {
-                                       showPointer( watchstar, $star );
-                               }, 2000 );
-                       }
+
+               // Determine if we should show the collection tutorial
+               if ( $star.length > 0 && shouldShow ) {
+                       // FIXME: Timeout shouldn't be necessary but T91047 
exists.
+                       setTimeout( function () {
+                               showPointer( watchstar, $star );
+                       }, 2000 );
                }
        }
-
-       init( M.getCurrentPage() );
+       // Only init when current page is an article
+       if ( !page.inNamespace( 'special' ) ) {
+               init( page );
+       }
 
 }( mw.mobileFrontend, jQuery ) );

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I2cf1d4c0e1b99331220693a79d1a9923fce96d19
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/extensions/Gather
Gerrit-Branch: master
Gerrit-Owner: Robmoen <[email protected]>
Gerrit-Reviewer: Jdlrobson <[email protected]>
Gerrit-Reviewer: Krinkle <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to