mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-24 14:33:59 +00:00
EditAttemptStep: Allow session ID override from query string or mw.config
Similar to WikiEditor, allow the editing_session_id value to be overriden through the editingStatsId query parameter. Also allow server-side code to override the session ID by setting wgWMESchemaEditAttemptStepSessionId in mw.config. Only apply the override to the first session. Once a second init event happens, discard the overridden editing_session_id and generate a fresh one. Bug: T238249 Change-Id: I4ede70f310a35c95b6eb9cc34cfcf2baa77e69ee
This commit is contained in:
parent
6caa4601aa
commit
0f97e1dce9
|
@ -16,10 +16,16 @@
|
||||||
saveSuccess: 'save_success',
|
saveSuccess: 'save_success',
|
||||||
saveFailure: 'save_failure'
|
saveFailure: 'save_failure'
|
||||||
},
|
},
|
||||||
trackdebug = !!mw.Uri().query.trackdebug;
|
trackdebug = !!mw.Uri().query.trackdebug,
|
||||||
|
firstInitDone = false;
|
||||||
|
|
||||||
|
function getEditingSessionIdFromRequest() {
|
||||||
|
return mw.config.get( 'wgWMESchemaEditAttemptStepSessionId' ) ||
|
||||||
|
mw.Uri().query.editingStatsId;
|
||||||
|
}
|
||||||
|
|
||||||
timing = {};
|
timing = {};
|
||||||
editingSessionId = mw.user.generateRandomSessionId();
|
editingSessionId = getEditingSessionIdFromRequest() || mw.user.generateRandomSessionId();
|
||||||
|
|
||||||
function log() {
|
function log() {
|
||||||
// mw.log is a no-op unless resource loader is in debug mode, so
|
// mw.log is a no-op unless resource loader is in debug mode, so
|
||||||
|
@ -86,8 +92,11 @@
|
||||||
timeStamp = timeStamp || this.timeStamp; // I8e82acc12 back-compat
|
timeStamp = timeStamp || this.timeStamp; // I8e82acc12 back-compat
|
||||||
|
|
||||||
if ( action === 'init' ) {
|
if ( action === 'init' ) {
|
||||||
// Regenerate editingSessionId
|
if ( firstInitDone ) {
|
||||||
editingSessionId = mw.user.generateRandomSessionId();
|
// Regenerate editingSessionId
|
||||||
|
editingSessionId = mw.user.generateRandomSessionId();
|
||||||
|
}
|
||||||
|
firstInitDone = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !inSample() && !mw.config.get( 'wgWMESchemaEditAttemptStepOversample' ) && !trackdebug ) {
|
if ( !inSample() && !mw.config.get( 'wgWMESchemaEditAttemptStepOversample' ) && !trackdebug ) {
|
||||||
|
|
Loading…
Reference in a new issue