Merge pull request #5302 from overleaf/ta-identify-identity

Skip Identify Job When userId Equal analyticsId

GitOrigin-RevId: 11eac0905dd0060df3556484db7ba301aba55375
This commit is contained in:
Alexandre Bourdin 2021-09-30 17:27:59 +02:00 committed by Copybot
parent 07e5d1ba90
commit 92f34757f7
2 changed files with 11 additions and 1 deletions

View file

@ -15,7 +15,7 @@ const analyticsUserPropertiesQueue = Queues.getAnalyticsUserPropertiesQueue()
const ONE_MINUTE_MS = 60 * 1000
function identifyUser(userId, analyticsId, isNewUser) {
if (!userId || !analyticsId) {
if (!userId || !analyticsId || userId === analyticsId) {
return
}
if (_isAnalyticsDisabled() || _isSmokeTestUser(userId)) {

View file

@ -70,6 +70,16 @@ describe('AnalyticsManager', function () {
this.AnalyticsManager.identifyUser(this.fakeUserId, '')
sinon.assert.notCalled(this.analyticsEventsQueue.add)
})
it('userId or analyticsId is missing', function () {
this.AnalyticsManager.identifyUser(this.fakeUserId, undefined)
sinon.assert.notCalled(this.analyticsEventsQueue.add)
})
it('userId equal analyticsId', function () {
this.AnalyticsManager.identifyUser(this.fakeUserId, this.fakeUserId)
sinon.assert.notCalled(this.analyticsEventsQueue.add)
})
})
describe('queues the appropriate message for', function () {