Robmoen has uploaded a new change for review.

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

Change subject: Init QuickSurveys only on existing pages in the main namespace
......................................................................

Init QuickSurveys only on existing pages in the main namespace

Bug: T113652
Change-Id: I3af29f39ce0b832999e70746e80163238d3a9f5f
---
M includes/QuickSurveys.hooks.php
1 file changed, 6 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/QuickSurveys 
refs/changes/05/240905/1

diff --git a/includes/QuickSurveys.hooks.php b/includes/QuickSurveys.hooks.php
index e009635..63d1c6a 100644
--- a/includes/QuickSurveys.hooks.php
+++ b/includes/QuickSurveys.hooks.php
@@ -29,7 +29,8 @@
        }
 
        /**
-        * BeforePageDisplay hook handler
+        * Init QuickSurveys in BeforePageDisplay hook on existing pages in the 
main namespace
+        *
         * @see https://www.mediawiki.org/wiki/Manual:Hooks/BeforePageDisplay
         *
         * @param OutputPage $out
@@ -37,7 +38,10 @@
         * @return bool
         */
        public static function onBeforePageDisplay( &$out, &$sk ) {
-               $out->addModules( 'ext.quicksurveys.init' );
+               $title = $out->getTitle();
+               if ( $title->inNamespace( NS_MAIN ) && $title->exists() ) {
+                       $out->addModules( 'ext.quicksurveys.init' );
+               }
                return true;
        }
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3af29f39ce0b832999e70746e80163238d3a9f5f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/QuickSurveys
Gerrit-Branch: dev
Gerrit-Owner: Robmoen <rm...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to