jenkins-bot has submitted this change and it was merged. Change subject: ext.centralNotice.display: API for registering tests ......................................................................
ext.centralNotice.display: API for registering tests Bug: T134286 Change-Id: I2957e8e42a4b6618959d4b11443232250c4ef594 --- M resources/subscribing/ext.centralNotice.display.js M resources/subscribing/ext.centralNotice.display.state.js 2 files changed, 30 insertions(+), 0 deletions(-) Approvals: Awight: Looks good to me, approved jenkins-bot: Verified diff --git a/resources/subscribing/ext.centralNotice.display.js b/resources/subscribing/ext.centralNotice.display.js index 755a044..aa6674b 100644 --- a/resources/subscribing/ext.centralNotice.display.js +++ b/resources/subscribing/ext.centralNotice.display.js @@ -542,6 +542,15 @@ }, /** + * Register that the current page view is included in a test. + * @param {string} identifier A string to identify the test. Should not contain + * commas. + */ + registerTest( identifier ) { + cn.internal.state.registerTest( identifier ); + }, + + /** * Get the value of a property used in campaign/banner selection and * display, and for recording the results of that process. */ diff --git a/resources/subscribing/ext.centralNotice.display.state.js b/resources/subscribing/ext.centralNotice.display.state.js index db369ad..bb27ac9 100644 --- a/resources/subscribing/ext.centralNotice.display.state.js +++ b/resources/subscribing/ext.centralNotice.display.state.js @@ -221,6 +221,7 @@ if ( cleanForURLSerialization ) { delete dataCopy.getVars; delete dataCopy.mixins; + delete dataCopy.tests; } return dataCopy; @@ -352,6 +353,26 @@ state.data.recordImpressionSampleRate = rate; }, + /** + * Register that the current page view is included in a test. + * @param {string} identifier A string to identify the test. Should not contain + * commas. + */ + registerTest( identifier ) { + var tests = state.data.tests = state.data.tests || []; + + // Add if it isn't already registered. + if ( $.inArray( identifier, tests ) === -1 ) { + tests.push( identifier ); + + if ( tests.length === 1 ) { + state.data.testIdentifiers = identifier; + } else { + state.data.testIdentifiers.concat( ',' + identifier ); + } + } + }, + lookupReasonCode: function( reasonName ) { if ( reasonName in REASONS ) { return REASONS[reasonName]; -- To view, visit https://gerrit.wikimedia.org/r/291118 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I2957e8e42a4b6618959d4b11443232250c4ef594 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/CentralNotice Gerrit-Branch: wmf_deploy Gerrit-Owner: Awight <awi...@wikimedia.org> Gerrit-Reviewer: AndyRussG <andrew.green...@gmail.com> Gerrit-Reviewer: Awight <awi...@wikimedia.org> Gerrit-Reviewer: Cdentinger <cdentin...@wikimedia.org> Gerrit-Reviewer: Ejegg <eeggles...@wikimedia.org> Gerrit-Reviewer: Ssmith <ssm...@wikimedia.org> Gerrit-Reviewer: XenoRyet <dkozlow...@wikimedia.org> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits