Edit check: some simple counters for steps in the process

Change-Id: Iac0faea1f06eb30ac075a702cdcaaec29e0fbaf0
This commit is contained in:
David Lynch 2024-08-01 11:16:04 -05:00
parent 31bd3f00cd
commit 57daf35bd6

View file

@ -166,6 +166,7 @@ if ( mw.config.get( 'wgVisualEditorConfig' ).editCheck || mw.editcheck.ecenable
let saveProcessDeferred;
mw.hook( 've.preSaveProcess' ).add( ( saveProcess, target ) => {
ve.track( 'counter.editcheck.preSaveChecksAvailable' );
const surface = target.getSurface();
if ( surface.getMode() !== 'visual' ) {
@ -181,6 +182,7 @@ if ( mw.config.get( 'wgVisualEditorConfig' ).editCheck || mw.editcheck.ecenable
let checks = mw.editcheck.editCheckFactory.createAllByListener( 'onBeforeSave', surface );
if ( checks.length ) {
ve.track( 'counter.editcheck.preSaveChecksShown' );
mw.editcheck.refCheckShown = true;
const surfaceView = surface.getView();
@ -323,10 +325,12 @@ if ( mw.config.get( 'wgVisualEditorConfig' ).editCheck || mw.editcheck.ecenable
const delay = ve.createDeferred();
// If they inserted, wait 2 seconds on desktop before showing save dialog
setTimeout( () => {
ve.track( 'counter.editcheck.preSaveChecksCompleted' );
delay.resolve();
}, !OO.ui.isMobile() && data.action !== 'reject' ? 2000 : 0 );
return delay.promise();
} else {
ve.track( 'counter.editcheck.preSaveChecksAbandoned' );
return ve.createDeferred().reject().promise();
}
} );