mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Merge pull request #8895 from overleaf/jpa-allow-empty-segmentation-val
[web] allow empty event segmentation values again GitOrigin-RevId: a02fd5085697bf7e2f2d4a5c2dc93dfebcd6e140
This commit is contained in:
parent
7705acfa1f
commit
daa9302fd3
2 changed files with 30 additions and 1 deletions
|
@ -243,7 +243,7 @@ function _checkPropertyValue(propertyValue) {
|
|||
}
|
||||
|
||||
function _isAttributeValid(attribute) {
|
||||
return attribute && /^[a-zA-Z0-9-_.:;,/]+$/.test(attribute)
|
||||
return !attribute || /^[a-zA-Z0-9-_.:;,/]+$/.test(attribute)
|
||||
}
|
||||
|
||||
function _isSegmentationValid(segmentation) {
|
||||
|
|
|
@ -209,6 +209,35 @@ describe('AnalyticsManager', function () {
|
|||
}
|
||||
)
|
||||
})
|
||||
|
||||
it('empty field in event segmentation', async function () {
|
||||
const timings = null
|
||||
await this.AnalyticsManager.recordEventForUser(
|
||||
this.fakeUserId,
|
||||
'an_event',
|
||||
{ compileTime: timings?.compileE2E }
|
||||
)
|
||||
sinon.assert.calledWithMatch(this.analyticsEventsQueue.add, 'event', {
|
||||
analyticsId: this.analyticsId,
|
||||
event: 'an_event',
|
||||
segmentation: { compileTime: undefined },
|
||||
isLoggedIn: true,
|
||||
})
|
||||
})
|
||||
|
||||
it('boolean field in event segmentation', async function () {
|
||||
await this.AnalyticsManager.recordEventForUser(
|
||||
this.fakeUserId,
|
||||
'an_event',
|
||||
{ isAutoCompile: false }
|
||||
)
|
||||
sinon.assert.calledWithMatch(this.analyticsEventsQueue.add, 'event', {
|
||||
analyticsId: this.analyticsId,
|
||||
event: 'an_event',
|
||||
segmentation: { isAutoCompile: false },
|
||||
isLoggedIn: true,
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('AnalyticsIdMiddleware', function () {
|
||||
|
|
Loading…
Reference in a new issue