jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/325770 )
Change subject: Fix tutorial step logging ...................................................................... Fix tutorial step logging I've removed the skip logic from mw.UploadWizard, since it wouldn't load the tutorial step if it was to be skipped. This in turn caused the tutorial step not to be logged. Keeping up with current practices, the tutorial controller is now in charge of self-skipping. The skip preference indicated by the checkmark was also influenced by UW config (if set to skip, the checkmark would also be checked, even if user preference said not to skip) Bug: T150016 Change-Id: I03f98ae7e82df2e4445a7ebf4ba9841418995d39 --- M resources/controller/uw.controller.Deed.js M resources/controller/uw.controller.Details.js M resources/controller/uw.controller.Thanks.js M resources/controller/uw.controller.Tutorial.js M resources/mw.UploadWizard.js 5 files changed, 27 insertions(+), 21 deletions(-) Approvals: MarkTraceur: Looks good to me, approved jenkins-bot: Verified diff --git a/resources/controller/uw.controller.Deed.js b/resources/controller/uw.controller.Deed.js index bd59876..aa546b7 100644 --- a/resources/controller/uw.controller.Deed.js +++ b/resources/controller/uw.controller.Deed.js @@ -96,6 +96,7 @@ // If all of the uploads are from URLs, then we know the licenses // already, we don't need this step. if ( !showDeed ) { + uw.eventFlowLogger.logSkippedStep( this.stepName ); // this is a bit of a hack: when images from flickr are uploaded, we // don't get to choose the license anymore, and this step will be // skipped ... but we could reach this step from either direction diff --git a/resources/controller/uw.controller.Details.js b/resources/controller/uw.controller.Details.js index 3561802..d1c8e0e 100644 --- a/resources/controller/uw.controller.Details.js +++ b/resources/controller/uw.controller.Details.js @@ -422,6 +422,7 @@ if ( this.uploads.length === 0 ) { // If we have no more uploads, go to the "Upload" step. (This will go to "Thanks" step, // which will skip itself in load() because there are no uploads left.) + uw.eventFlowLogger.logSkippedStep( this.stepName ); this.moveNext(); return; } diff --git a/resources/controller/uw.controller.Thanks.js b/resources/controller/uw.controller.Thanks.js index 7ed402f..d28d655 100644 --- a/resources/controller/uw.controller.Thanks.js +++ b/resources/controller/uw.controller.Thanks.js @@ -40,13 +40,14 @@ uw.controller.Thanks.prototype.load = function ( uploads ) { var thanks = this; + uw.controller.Step.prototype.load.call( this, uploads ); + if ( uploads.length === 0 ) { // We got here after the user removed all uploads; just restart from "Upload" step + uw.eventFlowLogger.logSkippedStep( this.stepName ); this.moveNext(); return; } - - uw.controller.Step.prototype.load.call( this, uploads ); $.each( uploads, function ( i, upload ) { thanks.ui.addUpload( upload ); diff --git a/resources/controller/uw.controller.Tutorial.js b/resources/controller/uw.controller.Tutorial.js index 217053c..ea1bb52 100644 --- a/resources/controller/uw.controller.Tutorial.js +++ b/resources/controller/uw.controller.Tutorial.js @@ -29,14 +29,16 @@ var controller = this; this.skipPreference = Boolean( mw.user.options.get( 'upwiz_skiptutorial' ) ); - - this.shouldSkipTutorial = false; + this.newSkipPreference = this.skipPreference; + this.skipped = false; uw.controller.Step.call( this, new uw.ui.Tutorial() .on( 'skip-tutorial-click', function ( skipped ) { - controller.shouldSkipTutorial = skipped; + // indicate that the skip preference has changed, so we can + // alter the preference when we move to another step + controller.newSkipPreference = skipped; if ( skipped ) { uw.eventFlowLogger.logTutorialAction( 'skip-check' ); } else { @@ -53,7 +55,7 @@ this.stepName = 'tutorial'; - this.ui.setSelected( this.skipPreference || ( config && config.tutorial && config.tutorial.skip ) ); + this.ui.setSelected( this.skipPreference ); }; OO.inheritClass( uw.controller.Tutorial, uw.controller.Step ); @@ -74,15 +76,27 @@ change: skip ? 'upwiz_skiptutorial=1' : 'upwiz_skiptutorial' } ).done( function () { allowCloseWindow.release(); - controller.skipPreference = controller.shouldSkipTutorial; + controller.skipPreference = skip; } ).fail( function ( code, err ) { mw.notify( err.textStatus ); } ); }; uw.controller.Tutorial.prototype.load = function ( uploads ) { + // tutorial can be skipped via preference, or config (e.g. campaign config) + var shouldSkipTutorial = this.skipPreference || ( this.config.tutorial && this.config.tutorial.skip ); + uw.controller.Step.prototype.load.call( this, uploads ); + uw.eventFlowLogger.logTutorialAction( 'load' ); + + // we only want to skip the tutorial once - if we come back to it, we + // don't want it to get auto-skipped again + if ( !this.skipped && shouldSkipTutorial ) { + this.skipped = true; + uw.eventFlowLogger.logSkippedStep( this.stepName ); + this.moveNext(); + } }; uw.controller.Tutorial.prototype.moveNext = function () { @@ -91,9 +105,8 @@ }; uw.controller.Tutorial.prototype.unload = function () { - // if the skip checkbox is checked, set the skip user preference - if ( this.shouldSkipTutorial !== this.skipPreference ) { - this.setSkipPreference( this.shouldSkipTutorial ); + if ( this.skipPreference !== this.newSkipPreference ) { + this.setSkipPreference( this.newSkipPreference ); } uw.controller.Step.prototype.unload.call( this ); diff --git a/resources/mw.UploadWizard.js b/resources/mw.UploadWizard.js index 616092c..7b88660 100644 --- a/resources/mw.UploadWizard.js +++ b/resources/mw.UploadWizard.js @@ -63,28 +63,18 @@ this.initialiseSteps(); // "select" the first step - highlight, make it visible, hide all others - this.steps.firstStep.load( [] ); + this.steps.tutorial.load( [] ); }, /** * Initialise the steps in the wizard */ initialiseSteps: function () { - var skipTutorial = this.config.tutorial.skip || - mw.user.options.get( 'upwiz_skiptutorial' ) || - ( this.config.tutorial && this.config.tutorial.skip ); - this.steps.tutorial = new uw.controller.Tutorial( this.api, this.config ); this.steps.file = new uw.controller.Upload( this.api, this.config ); this.steps.deeds = new uw.controller.Deed( this.api, this.config ); this.steps.details = new uw.controller.Details( this.api, this.config ); this.steps.thanks = new uw.controller.Thanks( this.api, this.config ); - - if ( skipTutorial ) { - this.steps.firstStep = this.steps.file; - } else { - this.steps.firstStep = this.steps.tutorial; - } this.steps.tutorial.setNextStep( this.steps.file ); -- To view, visit https://gerrit.wikimedia.org/r/325770 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I03f98ae7e82df2e4445a7ebf4ba9841418995d39 Gerrit-PatchSet: 3 Gerrit-Project: mediawiki/extensions/UploadWizard Gerrit-Branch: master Gerrit-Owner: Matthias Mullie <mmul...@wikimedia.org> Gerrit-Reviewer: Bartosz DziewoĆski <matma....@gmail.com> Gerrit-Reviewer: MarkTraceur <mholmqu...@wikimedia.org> Gerrit-Reviewer: Matthias Mullie <mmul...@wikimedia.org> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits