jenkins-bot has submitted this change and it was merged.
Change subject: Distinguish between VisualEditor and SourceEditor in event
logging
......................................................................
Distinguish between VisualEditor and SourceEditor in event logging
Log events in VisualEditor
Don't use MobileWebClickTracking for something related to editing.
Use it for switch events.
Change-Id: I5a4efd9d49fa36a048e80205204187bbd5e3f5a8
---
M includes/MobileFrontend.hooks.php
M javascripts/modules/editor/EditorOverlay.js
M javascripts/modules/editor/EditorOverlayBase.js
M javascripts/modules/editor/VisualEditorOverlay.js
4 files changed, 62 insertions(+), 64 deletions(-)
Approvals:
JGonera: Looks good to me, approved
jenkins-bot: Verified
diff --git a/includes/MobileFrontend.hooks.php
b/includes/MobileFrontend.hooks.php
index 4fdd45a..62b4db2 100644
--- a/includes/MobileFrontend.hooks.php
+++ b/includes/MobileFrontend.hooks.php
@@ -770,7 +770,7 @@
),
'mobile.editing.schema' => array(
'schema' => 'MobileWebEditing',
- 'revision' => 7675117,
+ 'revision' => 8599025,
),
'schema.MobileWebCta' => array(
'schema' => 'MobileWebCta',
diff --git a/javascripts/modules/editor/EditorOverlay.js
b/javascripts/modules/editor/EditorOverlay.js
index 6ffb1a8..274fe9b 100644
--- a/javascripts/modules/editor/EditorOverlay.js
+++ b/javascripts/modules/editor/EditorOverlay.js
@@ -1,8 +1,5 @@
( function( M, $ ) {
var EditorOverlayBase = M.require( 'modules/editor/EditorOverlayBase' ),
- popup = M.require( 'toast' ),
- schema = M.require( 'loggingSchemas/mobileWebEditing' ),
- MobileWebClickTracking = M.require(
'loggingSchemas/MobileWebClickTracking' ),
inBetaOrAlpha = M.isBetaGroupMember(),
isVisualEditorEnabled = M.isWideScreen() &&
M.isAlphaGroupMember() &&
@@ -27,18 +24,7 @@
header: M.template.get(
'modules/editor/EditorOverlayHeader' ),
content: M.template.get( 'modules/editor/EditorOverlay'
)
},
- log: function( action, errorText ) {
- var
- data = {
- action: action,
- section: this.sectionId,
- funnel: this.funnel
- };
- if ( errorText ) {
- data.errorText = errorText;
- }
- schema.log( data );
- },
+ editor: 'SourceEditor',
initialize: function( options ) {
this.api = new EditorApi( {
@@ -48,7 +34,6 @@
isNewPage: options.isNewPage
} );
this.readOnly = options.oldId ? true : false; // If old
revision, readOnly mode
- this.funnel = options.funnel;
if ( isVisualEditorEnabled ) {
options.editSwitcher = true;
}
@@ -69,13 +54,9 @@
self.api.setContent(
self.$content.val() );
self.$( '.continue, .submit' ).prop(
'disabled', false );
} );
- this.$( '.continue' ).on( M.tapEvent( 'click' ),
$.proxy( this, '_showPreview' ) );
+ this.$( '.continue' ).on( M.tapEvent( 'click' ),
$.proxy( this, '_prepareForSave' ) );
this.$( '.back' ).on( M.tapEvent( 'click' ), $.proxy(
this, '_hidePreview' ) );
this.$( '.submit' ).on( M.tapEvent( 'click' ), $.proxy(
this, '_save' ) );
- this.$( '.cancel' ).on( M.tapEvent( 'click' ),
function() {
- // log cancel attempt
- self.log( 'cancel' );
- } );
// make license links open in separate tabs
this.$( '.license a' ).attr( 'target', '_blank' );
@@ -84,11 +65,10 @@
if ( isVisualEditorEnabled ) {
this.$( '.visual-editor' ).on( 'click',
function() {
if ( !self.api.hasChanged ) {
- MobileWebClickTracking.log(
'editor-switch-to-visual', options.title );
self._switchToVisualEditor(
options );
} else {
if ( window.confirm( mw.msg(
'mobile-frontend-editor-switch-confirm' ) ) ) {
- self._showPreview();
+ self._prepareForSave();
}
}
} );
@@ -102,8 +82,6 @@
}
this._loadContent();
- // log section edit attempt
- self.log( 'attempt' );
if ( inNavSignupCampaign ) {
// Log edit page impression
mobileLeftNavbarEditCTA.log( {
@@ -123,11 +101,10 @@
}
},
- _showPreview: function() {
+ _prepareForSave: function() {
var self = this, params = { text: this.$content.val() };
- // log save button click
- this.log( 'save' );
+ this._super();
this._showHidden( '.save-header, .save-panel' );
this.scrollTop = $( 'body' ).scrollTop();
@@ -184,13 +161,12 @@
self.$spinner.hide();
} ).
fail( function( error ) {
- popup.show( mw.msg(
'mobile-frontend-editor-error-loading' ), 'toast error' );
- // log error that occurred in
retrieving section
- self.log( 'error', error );
+ self.reportError( mw.msg(
'mobile-frontend-editor-error-loading' ), error );
} );
},
_switchToVisualEditor: function( options ) {
+ this.log( 'switch' );
// Save a user setting indicating that this user
prefers using the VisualEditor
M.settings.saveUserSetting( 'preferredEditor',
'VisualEditor', true );
// Load the VisualEditor and replace the SourceEditor
overlay with it
@@ -220,17 +196,12 @@
var self = this,
options = { summary: this.$( '.summary' ).val()
};
- // Ask for confirmation in some cases
- if ( !this.confirmSave() ) {
- return;
- }
-
+ this._super();
if ( this.captchaId ) {
options.captchaId = this.captchaId;
options.captchaWord = this.$( '.captcha-word'
).val();
}
- self.log( 'submit' );
if ( inNavSignupCampaign ) {
mobileLeftNavbarEditCTA.log( {
action: 'page-save-attempt',
@@ -247,8 +218,6 @@
return;
}
- // log success!
- self.log( 'success' );
if ( inNavSignupCampaign ) {
mobileLeftNavbarEditCTA.log( {
action:
'page-save-success',
@@ -271,10 +240,8 @@
msg = mw.msg(
'mobile-frontend-editor-error' );
}
- popup.show( msg, 'toast error'
);
+ self.reportError( msg,
data.details );
self._showHidden(
'.save-header, .save-panel' );
- // log error that occurred in
retrieving section
- self.log( 'error', data.details
);
}
} );
},
diff --git a/javascripts/modules/editor/EditorOverlayBase.js
b/javascripts/modules/editor/EditorOverlayBase.js
index e726de8..6bedee0 100644
--- a/javascripts/modules/editor/EditorOverlayBase.js
+++ b/javascripts/modules/editor/EditorOverlayBase.js
@@ -1,9 +1,10 @@
( function( M, $ ) {
var OverlayNew = M.require( 'OverlayNew' ),
Page = M.require( 'Page' ),
+ schema = M.require( 'loggingSchemas/mobileWebEditing' ),
inKeepGoingCampaign = M.query.campaign === 'mobile-keepgoing',
- user = M.require( 'user' ),
toast = M.require( 'toast' ),
+ user = M.require( 'user' ),
EditorOverlayBase;
/**
@@ -27,6 +28,19 @@
},
template: M.template.get( 'modules/editor/EditorOverlayBase' ),
className: 'overlay editor-overlay',
+ log: function( action, errorText ) {
+ var
+ data = {
+ action: action,
+ section: this.sectionId,
+ editor: this.editor,
+ funnel: this.funnel
+ };
+ if ( errorText ) {
+ data.errorText = errorText;
+ }
+ schema.log( data );
+ },
_updateEditCount: function() {
this.editCount += 1;
@@ -59,6 +73,7 @@
* messages, and setting mobile edit cookie.
*/
onSave: function() {
+ this.log( 'success' );
var title = this.options.title,
extraToastClasses = '', msg;
@@ -126,6 +141,7 @@
this.isNewPage = options.isNewPage;
this.isNewEditor = options.isNewEditor;
this.sectionId = options.sectionId;
+ this.funnel = options.funnel;
// pre-fetch keep going with expectation user will go
on to save
if ( this._shouldShowKeepGoingOverlay() ) {
@@ -134,7 +150,29 @@
this._super( options );
},
+ reportError: function ( msg, errorText ) {
+ this.log( 'error', errorText );
+ toast.show( msg, 'toast error' );
+ },
+ _prepareForSave: function() {
+ this.log( 'save' );
+ },
+ _save: function() {
+ // Ask for confirmation in some cases
+ if ( !this.confirmSave() ) {
+ return;
+ }
+ this.log( 'submit' );
+ },
postRender: function( options ) {
+ var self = this;
+ // log edit attempt
+ this.log( 'attempt' );
+
+ this.$( '.cancel' ).on( M.tapEvent( 'click' ),
function() {
+ // log cancel attempt
+ self.log( 'cancel' );
+ } );
this._super( options );
this._showHidden( '.initial-header' );
},
diff --git a/javascripts/modules/editor/VisualEditorOverlay.js
b/javascripts/modules/editor/VisualEditorOverlay.js
index cec802c..8e449ed 100644
--- a/javascripts/modules/editor/VisualEditorOverlay.js
+++ b/javascripts/modules/editor/VisualEditorOverlay.js
@@ -1,7 +1,5 @@
( function( M, $, ve ) {
var EditorOverlayBase = M.require( 'modules/editor/EditorOverlayBase' ),
- popup = M.require( 'toast' ),
- MobileWebClickTracking = M.require(
'loggingSchemas/MobileWebClickTracking' ),
VisualEditorOverlay;
/**
@@ -14,6 +12,7 @@
content: M.template.get(
'modules/editor/VisualEditorOverlay' )
},
className: 'overlay editor-overlay editor-overlay-ve',
+ editor: 'VisualEditor',
initialize: function( options ) {
var self = this;
options.previewingMsg = mw.msg(
'mobile-frontend-page-saving', options.title );
@@ -74,13 +73,12 @@
postRender: function( options ) {
var self = this;
// Save button
- this.$( '.continue' ).on( 'click', $.proxy( this,
'prepareForSave' ) );
- this.$( '.submit' ).on( 'click', $.proxy( this, 'save'
) );
+ this.$( '.continue' ).on( 'click', $.proxy( this,
'_prepareForSave' ) );
+ this.$( '.submit' ).on( 'click', $.proxy( this, '_save'
) );
this.$( '.back' ).on( 'click', $.proxy( this,
'switchToEditor' ) );
this.$( '.source-editor' ).on( 'click', function() {
// If changes have been made tell the user they
have to save first
if ( !self.hasChanged ) {
- MobileWebClickTracking.log(
'editor-switch-to-source', options.title );
self.switchToSourceEditor( options );
} else {
if ( window.confirm( mw.msg(
'mobile-frontend-editor-switch-confirm' ) ) ) {
@@ -95,22 +93,19 @@
this.$( '.surface' ).show();
this.docToSave = false;
},
- prepareForSave: function() {
+ _prepareForSave: function() {
+ this._super();
this.$( '.surface' ).hide();
this._showHidden( '.save-header, .save-panel' );
},
- save: function() {
+ _save: function() {
var
self = this,
doc =
this.target.surface.getModel().getDocument(),
summary = this.$( '.save-panel input' ).val(),
options = { summary: summary };
- // Ask for confirmation in some cases
- if ( !this.confirmSave() ) {
- return;
- }
-
+ this._super();
this._showHidden( '.saving-header' );
// Stop the confirmation message from being thrown when
you hit save.
this.hasChanged = false;
@@ -130,6 +125,7 @@
} );
},
switchToSourceEditor: function( options ) {
+ this.log( 'switch' );
// Save a user setting indicating that this user
prefers using the SourceEditor
M.settings.saveUserSetting( 'preferredEditor',
'SourceEditor', true );
// Load the SourceEditor and replace the VisualEditor
overlay with it
@@ -149,9 +145,6 @@
this.clearSpinner();
this.destroyTarget();
},
- reportError: function ( msg ) {
- popup.show( msg, 'toast error' );
- },
onSurfaceReady: function () {
this.clearSpinner();
this.target.surface.getModel().getDocument().connect(
this, { 'transact': 'onTransact' } );
@@ -169,19 +162,19 @@
this.$continueBtn.prop( 'disabled', false );
},
onLoadError: function () {
- this.reportError( mw.msg(
'mobile-frontend-editor-error-loading' ) );
+ this.reportError( mw.msg(
'mobile-frontend-editor-error-loading' ), 've-load-error' );
},
onSerializeError: function ( jqXHR, status ) {
- this.reportError( mw.msg(
'visualeditor-serializeerror', status ) );
+ this.reportError( mw.msg(
'visualeditor-serializeerror', status ), 've-serialize-error' );
},
onConflictError: function () {
- this.reportError( mw.msg(
'mobile-frontend-editor-error-conflict' ) );
+ this.reportError( mw.msg(
'mobile-frontend-editor-error-conflict' ), 've-conflict-error' );
},
onShowChangesError: function () {
- this.reportError( mw.msg( 'visualeditor-differror' ) );
+ this.reportError( mw.msg( 'visualeditor-differror' ),
've-show-changes-error' );
},
onSaveError: function () {
- this.reportError( mw.msg(
'mobile-frontend-editor-error' ) );
+ this.reportError( mw.msg(
'mobile-frontend-editor-error' ), 've-save-error' );
},
onSaveErrorCaptcha: function ( editApi ) {
this.captchaId = editApi.captcha.id;
--
To view, visit https://gerrit.wikimedia.org/r/134527
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I5a4efd9d49fa36a048e80205204187bbd5e3f5a8
Gerrit-PatchSet: 8
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Jdlrobson <[email protected]>
Gerrit-Reviewer: Awjrichards <[email protected]>
Gerrit-Reviewer: JGonera <[email protected]>
Gerrit-Reviewer: Jdlrobson <[email protected]>
Gerrit-Reviewer: Kaldari <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits