From 3b8f6019c4bb3f50067c6180cc5b694e5a8c63ae Mon Sep 17 00:00:00 2001 From: Ryan VanderMeulen Date: Fri, 24 Jun 2016 15:41:09 -0400 Subject: [PATCH] Backed out changeset 0b20196061d7 (bug 1276054) for browser_UITour_pocket.js failures. --- browser/extensions/pocket/content/main.js | 32 ++++++----------- .../pocket/content/panels/js/signup.js | 18 +++++----- browser/extensions/pocket/content/pktApi.jsm | 34 +++++++------------ browser/extensions/pocket/install.rdf.in | 2 +- 4 files changed, 33 insertions(+), 53 deletions(-) diff --git a/browser/extensions/pocket/content/main.js b/browser/extensions/pocket/content/main.js index 45bd78ba0a1c..31bed449f117 100644 --- a/browser/extensions/pocket/content/main.js +++ b/browser/extensions/pocket/content/main.js @@ -128,24 +128,6 @@ var pktUI = (function() { * Show the sign-up panel */ function showSignUp() { - // AB test: Direct logged-out users to tab vs panel - if (pktApi.getSignupPanelTabTestVariant() == 'tab') - { - let site = Services.prefs.getCharPref("extensions.pocket.site"); - openTabWithUrl('https://' + site + '/firefox_learnmore?src=ff_ext&s=ffi&t=buttonclick', true); - - // force the panel closed before it opens - // wrapped in setTimeout to avoid race condition after logging out - // if this test goes to 100%, we should move this logic up before - // the panel is actually opened - setTimeout(function() { - getPanel().hidePopup(); - }, 0); - - return; - } - - // Control: Show panel as normal getFirefoxAccountSignedInUser(function(userdata) { var fxasignedin = (typeof userdata == 'object' && userdata !== null) ? '1' : '0'; @@ -156,7 +138,7 @@ var pktUI = (function() { { startheight = overflowMenuHeight; } - else + else if (pktApi.getSignupAB().indexOf('storyboard') > -1) { startheight = 460; if (fxasignedin == '1') @@ -164,6 +146,13 @@ var pktUI = (function() { startheight = 406; } } + else + { + if (fxasignedin == '1') + { + startheight = 436; + } + } var variant; if (inOverflowMenu) { @@ -171,17 +160,16 @@ var pktUI = (function() { } else { - variant = 'storyboard_lm'; + variant = pktApi.getSignupAB(); } - var panelId = showPanel("about:pocket-signup?pockethost=" + Services.prefs.getCharPref("extensions.pocket.site") + "&fxasignedin=" + fxasignedin + "&variant=" + variant + '&inoverflowmenu=' + inOverflowMenu + "&locale=" + getUILocale(), { onShow: function() { }, onHide: panelDidHide, width: inOverflowMenu ? overflowMenuWidth : 300, height: startheight + }); }); - }); } /** diff --git a/browser/extensions/pocket/content/panels/js/signup.js b/browser/extensions/pocket/content/panels/js/signup.js index 2f69e8671f15..75c4427aec98 100644 --- a/browser/extensions/pocket/content/panels/js/signup.js +++ b/browser/extensions/pocket/content/panels/js/signup.js @@ -104,7 +104,7 @@ PKT_SIGNUP_OVERLAY.prototype = { this.dictJSON.variant = (this.variant ? this.variant : 'undefined'); this.dictJSON.variant += this.fxasignedin ? '_fxa' : '_nonfxa'; this.dictJSON.pockethost = this.pockethost; - this.dictJSON.showlearnmore = true; + this.dictJSON.showlearnmore = (this.variant.indexOf('_lm') > -1 || this.variant == 'storyboard' || this.variant == 'hero') ? 1 : 0; // extra modifier class for collapsed state if (this.inoverflowmenu) @@ -119,14 +119,14 @@ PKT_SIGNUP_OVERLAY.prototype = { } // Create actual content - if (this.variant == 'overflow') - { - $('body').append(Handlebars.templates.signup_shell(this.dictJSON)); - } - else - { - $('body').append(Handlebars.templates.signupstoryboard_shell(this.dictJSON)); - } + if (this.variant == 'storyboard' || this.variant == 'storyboard_lm' || this.variant == 'storyboard_nlm') + { + $('body').append(Handlebars.templates.signupstoryboard_shell(this.dictJSON)); + } + else + { + $('body').append(Handlebars.templates.signup_shell(this.dictJSON)); + } // tell background we're ready diff --git a/browser/extensions/pocket/content/pktApi.jsm b/browser/extensions/pocket/content/pktApi.jsm index a62f94c686fe..df07f2e782de 100644 --- a/browser/extensions/pocket/content/pktApi.jsm +++ b/browser/extensions/pocket/content/pktApi.jsm @@ -609,32 +609,24 @@ var pktApi = (function() { /** * Helper function to get current signup AB group the user is in */ - function getSignupPanelTabTestVariant() { - return getSimpleTestOption('panelTab', 0.1, 'tab'); - } - - function getSimpleTestOption(testName, threshold, testOptionName) { - // Get the test from preferences if we've already assigned the user to a test - var settingName = 'test.' + testName; - var assignedValue = getSetting(settingName); - - // If not assigned yet, pick and store a value - if (!assignedValue) + function getSignupAB() { + var setting = getSetting('signupAB'); + if (!setting || setting.includes('hero')) { - if (Math.random() <= threshold) { - assignedValue = testOptionName; + var rand = (Math.floor(Math.random()*100+1)); + if (rand > 90) + { + setting = 'storyboard_nlm'; } - else { - assignedValue = 'control'; + else + { + setting = 'storyboard_lm'; } - - setSetting('test.'+testName, assignedValue); + setSetting('signupAB',setting); } - - return assignedValue; + return setting; } - /** * Public functions */ @@ -649,6 +641,6 @@ var pktApi = (function() { isPremiumUser: isPremiumUser, getSuggestedTagsForItem: getSuggestedTagsForItem, getSuggestedTagsForURL: getSuggestedTagsForURL, - getSignupPanelTabTestVariant: getSignupPanelTabTestVariant, + getSignupAB: getSignupAB }; }()); diff --git a/browser/extensions/pocket/install.rdf.in b/browser/extensions/pocket/install.rdf.in index b5aa68e067bf..3e5b4fcdf7f8 100644 --- a/browser/extensions/pocket/install.rdf.in +++ b/browser/extensions/pocket/install.rdf.in @@ -10,7 +10,7 @@ firefox@getpocket.com - 1.0.4 + 1.0.3b1 2 true