AndyRussG has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/392743 )
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, 25 insertions(+), 9 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CentralNotice
refs/changes/43/392743/1
diff --git a/resources/subscribing/ext.centralNotice.largeBannerLimit.js
b/resources/subscribing/ext.centralNotice.largeBannerLimit.js
index 9ec1f81..a19bbaa 100644
--- a/resources/subscribing/ext.centralNotice.largeBannerLimit.js
+++ b/resources/subscribing/ext.centralNotice.largeBannerLimit.js
@@ -111,6 +111,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 +132,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( 'largeBannerLimit: hidden' );
+ return;
+ }
+
+ if ( !isLarge() ) {
+ cn.setDebugInfo( 'largeBannerLimit: 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( 'largeBannerLimit: 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( 'largeBannerLimit: flag found,
switching' );
+ switchToHigherBucket = true;
+ }
+
+ if ( switchToHigherBucket ) {
if ( mixinParams.randomize ) {
cn.setBucket( Math.floor( Math.random() * 2 ) +
2 );
} else {
@@ -167,6 +182,7 @@
!forced &&
cn.isBannerShown()
) {
+ cn.setDebugInfo( 'largeBannerLimit: setting flag' );
setFlag();
}
} );
--
To view, visit https://gerrit.wikimedia.org/r/392743
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I2639b4dcb382746f6fb2c2f34555477d75d02e65
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CentralNotice
Gerrit-Branch: master
Gerrit-Owner: AndyRussG <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits