jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/392755 )

Change subject: large banner limit: debugging instrumentation
......................................................................


large banner limit: debugging instrumentation

Bug: T180478
Change-Id: I2639b4dcb382746f6fb2c2f34555477d75d02e65
---
M resources/subscribing/ext.centralNotice.largeBannerLimit.js
1 file changed, 26 insertions(+), 9 deletions(-)

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



diff --git a/resources/subscribing/ext.centralNotice.largeBannerLimit.js 
b/resources/subscribing/ext.centralNotice.largeBannerLimit.js
index 9ec1f81..7e7cf37 100644
--- a/resources/subscribing/ext.centralNotice.largeBannerLimit.js
+++ b/resources/subscribing/ext.centralNotice.largeBannerLimit.js
@@ -40,6 +40,7 @@
 
                if ( mw.cookie.get( identifier, '' ) ) {
 
+                       cn.setDebugInfo( 'lbl: setting flag from legacy cookie' 
);
                        setFlag();
 
                        // Remove the legacy cookie
@@ -111,6 +112,8 @@
 
        mixin.setPreBannerHandler( function ( mixinParams ) {
 
+               var switchToHigherBucket = false;
+
                // Forced URL param. If we're showing a banner, it'll be the 
one for
                // whichever bucket we're already in. No changes to storage.
                if ( forced ) {
@@ -130,21 +133,34 @@
 
                // No need to switch if the banner's already hidden or we're 
already
                // on a small banner bucket
-               if ( cn.isBannerCanceled() || !isLarge() ) {
+               if ( cn.isBannerCanceled() ) {
+                       cn.setDebugInfo( 'lbl: hidden' );
+                       return;
+               }
+
+               if ( !isLarge() ) {
+                       cn.setDebugInfo( 'lbl: previously switched' );
                        return;
                }
 
                // If we can't store a flag, or if there is a flag, go to a 
small banner
 
-               // Note: if there was a legacy cookie flag, either it was 
migrated (in
-               // which case checkFlag() will return true) or it was deleted 
and couldn't
-               // be set on the current system, due to having no storage 
options (in
-               // which case we'll always switch to small banners).
+               if ( multiStorageOption === 
cn.kvStore.multiStorageOptions.NO_STORAGE ) {
+                       cn.setDebugInfo( 'lbl: no storage, switching' );
+                       switchToHigherBucket = true;
 
-               if (
-                       multiStorageOption === 
cn.kvStore.multiStorageOptions.NO_STORAGE ||
-                       checkFlag()
-               ) {
+               } else if ( checkFlag() ) {
+
+                       // Note: if there was a legacy cookie flag, either it 
was migrated (in
+                       // which case checkFlag() will return true) or it was 
deleted and couldn't
+                       // be set on the current system, due to having no 
storage options (in
+                       // which case we'll always switch to small banners).
+
+                       cn.setDebugInfo( 'lbl: flag found, switching' );
+                       switchToHigherBucket = true;
+               }
+
+               if ( switchToHigherBucket ) {
                        if ( mixinParams.randomize ) {
                                cn.setBucket( Math.floor( Math.random() * 2 ) + 
2 );
                        } else {
@@ -167,6 +183,7 @@
                        !forced &&
                        cn.isBannerShown()
                ) {
+                       cn.setDebugInfo( 'lbl: setting flag' );
                        setFlag();
                }
        } );

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I2639b4dcb382746f6fb2c2f34555477d75d02e65
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CentralNotice
Gerrit-Branch: wmf_deploy
Gerrit-Owner: AndyRussG <andrew.green...@gmail.com>
Gerrit-Reviewer: AndyRussG <andrew.green...@gmail.com>
Gerrit-Reviewer: Ejegg <ej...@ejegg.com>
Gerrit-Reviewer: XenoRyet <dkozlow...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to