Sumit has uploaded a new change for review.

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

Change subject: WikidataPageBanner disable on diff pages
......................................................................

WikidataPageBanner disable on diff pages

Show no banner when viewing a diff of a page.

Bug: T110384
Change-Id: I922921142af086402a685078860760351243efcd
---
M includes/WikidataPageBanner.hooks.php
1 file changed, 4 insertions(+), 3 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikidataPageBanner 
refs/changes/92/235492/1

diff --git a/includes/WikidataPageBanner.hooks.php 
b/includes/WikidataPageBanner.hooks.php
index 4137b0c..ba7d5f2 100644
--- a/includes/WikidataPageBanner.hooks.php
+++ b/includes/WikidataPageBanner.hooks.php
@@ -21,8 +21,9 @@
        public static function addBanner( OutputPage $out ) {
                global $wgWPBImage, $wgWPBNamespaces, $wgWPBEnableDefaultBanner;
                $title = $out->getTitle();
-               // if banner-options are set, add banner anyway
-               if ( $out->getProperty( 'wpb-banner-options' ) !== null ) {
+               $isDiff = $out->getRequest()->getVal( 'diff' );
+               // if banner-options are set and not a diff page, add banner 
anyway
+               if ( $out->getProperty( 'wpb-banner-options' ) !== null && 
!$isDiff ) {
                        $params = $out->getProperty( 'wpb-banner-options' );
                        $bannername = $params['name'];
                        $out->enableOOUI();
@@ -50,7 +51,7 @@
                        }
                }
                // if the page uses no 'PAGEBANNER' invocation and if article 
page, insert default banner
-               elseif ( $title->isKnown() && $out->isArticle() && 
$wgWPBEnableDefaultBanner ) {
+               elseif ( $title->isKnown() && $out->isArticle() && 
$wgWPBEnableDefaultBanner && !$isDiff ) {
                        $ns = $title->getNamespace();
                        // banner only on specified namespaces, and not Main 
Page of wiki
                        if ( in_array( $ns, $wgWPBNamespaces )

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I922921142af086402a685078860760351243efcd
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WikidataPageBanner
Gerrit-Branch: master
Gerrit-Owner: Sumit <[email protected]>

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

Reply via email to