From 992630c70569ccbcfce7266064c2de733e850cfd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartosz=20Dziewo=C5=84ski?= Date: Fri, 21 Sep 2018 05:17:02 +0200 Subject: [PATCH] Remove broken remains of &campaign=leftNavSignup handling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This code could never be used under normal circumstances since a crucial bit of it was removed from MobileFrontend in 2015: (I65e943b6dad8bfea994020f9f555bd095da1a171) // Allow us to distinguish sign ups from the left nav to logins. // This allows us to show them an edit tutorial when they return to the page. if ( $query['returntoquery'] === 'welcome=yes' ) { $query['returntoquery'] = 'campaign=leftNavSignup'; } …and honestly, that's for good, because it fails horribly when triggered by adding &campaign=leftNavSignup to the URL manually: clicking "Start editing" in the callout navigates you to an article called "Undefined/leftNavSignup". Bug: T205325 Change-Id: I0e385488be5b2eaa7d489029b91e18b336c0d133 --- includes/skins/SkinMinerva.php | 5 +--- resources/skins.minerva.newusers/init.js | 29 +++--------------------- 2 files changed, 4 insertions(+), 30 deletions(-) diff --git a/includes/skins/SkinMinerva.php b/includes/skins/SkinMinerva.php index d726fa84f..0f805702e 100644 --- a/includes/skins/SkinMinerva.php +++ b/includes/skins/SkinMinerva.php @@ -696,8 +696,6 @@ class SkinMinerva extends SkinTemplate { [ 'data-event-name' => 'logout' ] ); } else { - // note welcome=yes in returnto allows us to detect accounts created from the left nav - $returntoquery[ 'welcome' ] = 'yes'; // unset campaign on login link so as not to interfere with A/B tests unset( $returntoquery['campaign'] ); $query[ 'returntoquery' ] = wfArrayToCgi( $returntoquery ); @@ -1309,7 +1307,6 @@ class SkinMinerva extends SkinTemplate { $user = $this->getUser(); $req = $this->getRequest(); $action = $req->getVal( 'article_action' ); - $campaign = $req->getVal( 'campaign' ); $title = $this->getTitle(); if ( !$title->isSpecialPage() ) { @@ -1328,7 +1325,7 @@ class SkinMinerva extends SkinTemplate { } if ( $this->isCurrentPageEditableByUser() ) { - if ( $action === 'signup-edit' || $campaign === 'leftNavSignup' ) { + if ( $action === 'signup-edit' ) { $modules[] = 'skins.minerva.newusers'; } } diff --git a/resources/skins.minerva.newusers/init.js b/resources/skins.minerva.newusers/init.js index 5d72e5c62..783340d86 100644 --- a/resources/skins.minerva.newusers/init.js +++ b/resources/skins.minerva.newusers/init.js @@ -1,13 +1,8 @@ -/* This code currently handles two different editing tutorials/CTAs: +/* This code handles the editing tutorial/CTA: EditTutorial - When an editor registers via the edit page action, upon returning to the page, show a blue guider prompting them to continue editing. You can replicate this by appending article_action=signup-edit to the URL of an editable page whilst logged in. - -LeftNavEditTutorial - When an editor registers via the left navigation menu, upon -returning to the page, show a blue tutorial in 50% of cases prompting them to try -editing. You can replicate this by appending campaign=leftNavSignup to the URL of an -editable page whilst logged in, although you must be in test group A to see the CTA. */ ( function ( M, $ ) { var PointerOverlay = M.require( 'skins.minerva.newusers/PointerOverlay' ), @@ -17,17 +12,7 @@ editable page whilst logged in, although you must be in test group A to see the escapeHash = util.escapeHash, inEditor = window.location.hash.indexOf( '#editor/' ) > -1, hash = window.location.hash, - editOverlay, target, $target, href; - - /** - * Whether or not the user should see the leftNav guider - * @ignore - * @return {boolean} - */ - function shouldShowLeftNavEditTutorial() { - return mw.util.getParamValue( 'campaign' ) === 'leftNavSignup' && - mw.config.get( 'wgNamespaceNumber' ) === 0 && !inEditor; - } + editOverlay, target; /** * If the user came from an edit button signup, show guider. @@ -36,7 +21,7 @@ editable page whilst logged in, although you must be in test group A to see the */ function shouldShowTutorial() { var shouldShowEditTutorial = mw.util.getParamValue( 'article_action' ) === 'signup-edit' && !inEditor; - return shouldShowEditTutorial || shouldShowLeftNavEditTutorial(); + return shouldShowEditTutorial; } if ( hash && hash.indexOf( '/' ) === -1 ) { @@ -47,14 +32,6 @@ editable page whilst logged in, although you must be in test group A to see the // Note the element might have a new ID if the wikitext was changed so check it exists if ( $( target ).length > 0 && shouldShowTutorial() ) { - - if ( shouldShowLeftNavEditTutorial() ) { - // Append the funnel name to the edit link's url - $target = $( target ); - href = $target.attr( 'href' ); - $target.attr( 'href', href + '/leftNavSignup' ); - } - editOverlay = new PointerOverlay( { target: target, skin: skin,