From 415cc0d0223226f7598ec53db75aaf9bf0273dbb Mon Sep 17 00:00:00 2001 From: David Lynch Date: Mon, 1 Apr 2019 11:56:15 -0500 Subject: [PATCH] trackSubscriber: don't populate all fields, to make validation happy The EditAttemptStep schema doesn't have some of the fields we attempt to submit, because we're generalizing and it only wants specific ones. Be more selective about what we submit, so validation messages in the console will be quiet. Bug: T218163 Change-Id: Iaf9f47b61c138bb0106b2dfc4be2caec02a10d1d --- modules/ve-mw/init/ve.init.mw.trackSubscriber.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/modules/ve-mw/init/ve.init.mw.trackSubscriber.js b/modules/ve-mw/init/ve.init.mw.trackSubscriber.js index b8bd02e589..a6cb111a15 100644 --- a/modules/ve-mw/init/ve.init.mw.trackSubscriber.js +++ b/modules/ve-mw/init/ve.init.mw.trackSubscriber.js @@ -153,13 +153,22 @@ event.user_class = 'IP'; } - event[ actionPrefix + '_type' ] = event.type; - event[ actionPrefix + '_mechanism' ] = event.mechanism; + // Schema's kind of a mess of special properties + if ( action === 'init' || action === 'abort' || action === 'saveFailure' ) { + event[ actionPrefix + '_type' ] = event.type; + } + if ( action === 'init' || action === 'abort' ) { + event[ actionPrefix + '_mechanism' ] = event.mechanism; + } if ( action !== 'init' ) { + // Schema actually does have an init_timing field, but we don't want to + // store it because it's not meaningful. duration = Math.round( computeDuration( action, event, timeStamp ) ); event[ actionPrefix + '_timing' ] = duration; } - event[ actionPrefix + '_message' ] = event.message; + if ( action === 'saveFailure' ) { + event[ actionPrefix + '_message' ] = event.message; + } /* eslint-enable camelcase */ // Remove renamed properties