mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Popups
synced 2024-11-28 01:10:04 +00:00
Don't log editCountBucket when user is logged out
Bug: T156893 Change-Id: I3cdfbe0c9872407b900f0676396b0bc3102a43fd
This commit is contained in:
parent
83821e105c
commit
75aaf7a23e
|
@ -8,7 +8,7 @@
|
|||
* @return {Object}
|
||||
*/
|
||||
function getBaseData( bootAction ) {
|
||||
return {
|
||||
var result = {
|
||||
pageTitleSource: bootAction.page.title,
|
||||
namespaceIdSource: bootAction.page.namespaceID,
|
||||
pageIdSource: bootAction.page.id,
|
||||
|
@ -16,10 +16,15 @@
|
|||
popupEnabled: bootAction.isEnabled,
|
||||
pageToken: bootAction.pageToken,
|
||||
sessionToken: bootAction.sessionToken,
|
||||
editCountBucket: popups.counts.getEditCountBucket( bootAction.user.editCount ),
|
||||
previewCountBucket: popups.counts.getPreviewCountBucket( bootAction.user.previewCount ),
|
||||
hovercardsSuppressedByGadget: bootAction.isNavPopupsEnabled
|
||||
};
|
||||
|
||||
if ( !bootAction.user.isAnon ) {
|
||||
result.editCountBucket = popups.counts.getEditCountBucket( bootAction.user.editCount );
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -41,13 +41,16 @@
|
|||
}
|
||||
},
|
||||
expectedEditCountBucket,
|
||||
expectedPreviewCountBucket;
|
||||
expectedPreviewCountBucket,
|
||||
state;
|
||||
|
||||
expectedEditCountBucket = counts.getEditCountBucket( action.user.editCount );
|
||||
expectedPreviewCountBucket = counts.getPreviewCountBucket( action.user.previewCount );
|
||||
|
||||
state = mw.popups.reducers.eventLogging( this.initialState, action );
|
||||
|
||||
assert.deepEqual(
|
||||
mw.popups.reducers.eventLogging( this.initialState, action ),
|
||||
state,
|
||||
{
|
||||
previewCount: action.user.previewCount,
|
||||
baseData: {
|
||||
|
@ -68,6 +71,20 @@
|
|||
interaction: undefined
|
||||
}
|
||||
);
|
||||
|
||||
// ---
|
||||
|
||||
// And when the user is logged out...
|
||||
action.user.isAnon = true;
|
||||
|
||||
state = mw.popups.reducers.eventLogging( this.initialState, action );
|
||||
|
||||
assert.strictEqual( state.baseData.isAnon, true );
|
||||
assert.strictEqual(
|
||||
state.baseData.editCountBucket,
|
||||
undefined,
|
||||
'It shouldn\'t add the editCountBucket property when the user is logged out.'
|
||||
);
|
||||
} );
|
||||
|
||||
QUnit.test( 'EVENT_LOGGED', function ( assert ) {
|
||||
|
|
Loading…
Reference in a new issue