From 62df7b32ebf2b94c5c55b299815a2b41fbe96cd7 Mon Sep 17 00:00:00 2001 From: Thomas Date: Fri, 11 Feb 2022 13:07:44 +0100 Subject: [PATCH] Merge pull request #6559 from overleaf/tm-teardown-onboarding-email-split-test Implement 'send-email' variant for trial onboarding email for all users GitOrigin-RevId: f53b86d875a1a4e146dc57603b7a83ac098f9cdf --- .../Subscription/RecurlyEventHandler.js | 11 +--------- .../Subscription/RecurlyEventHandlerTests.js | 22 +------------------ 2 files changed, 2 insertions(+), 31 deletions(-) diff --git a/services/web/app/src/Features/Subscription/RecurlyEventHandler.js b/services/web/app/src/Features/Subscription/RecurlyEventHandler.js index 76397ca511..c226c9fc87 100644 --- a/services/web/app/src/Features/Subscription/RecurlyEventHandler.js +++ b/services/web/app/src/Features/Subscription/RecurlyEventHandler.js @@ -1,5 +1,4 @@ const AnalyticsManager = require('../Analytics/AnalyticsManager') -const SplitTestHandler = require('../SplitTests/SplitTestHandler') const SubscriptionEmailHandler = require('./SubscriptionEmailHandler') const { ObjectID } = require('mongodb') @@ -66,16 +65,8 @@ async function _sendSubscriptionStartedEvent(userId, eventData) { isTrial ) - // send the trial onboarding email if (isTrial) { - const assignment = await SplitTestHandler.promises.getAssignmentForUser( - userId, - 'trial-onboarding-email' - ) - - if (assignment.variant === 'send-email') { - await SubscriptionEmailHandler.sendTrialOnboardingEmail(userId) - } + await SubscriptionEmailHandler.sendTrialOnboardingEmail(userId) } } diff --git a/services/web/test/unit/src/Subscription/RecurlyEventHandlerTests.js b/services/web/test/unit/src/Subscription/RecurlyEventHandlerTests.js index 81584cbcc2..293dabf4c7 100644 --- a/services/web/test/unit/src/Subscription/RecurlyEventHandlerTests.js +++ b/services/web/test/unit/src/Subscription/RecurlyEventHandlerTests.js @@ -29,11 +29,6 @@ describe('RecurlyEventHandler', function () { './SubscriptionEmailHandler': (this.SubscriptionEmailHandler = { sendTrialOnboardingEmail: sinon.stub(), }), - '../SplitTests/SplitTestHandler': (this.SplitTestHandler = { - promises: { - getAssignmentForUser: sinon.stub().resolves({ variant: 'default' }), - }, - }), '../Analytics/AnalyticsManager': (this.AnalyticsManager = { recordEventForUser: sinon.stub(), setUserPropertyForUser: sinon.stub(), @@ -75,28 +70,14 @@ describe('RecurlyEventHandler', function () { 'subscription-is-trial', true ) - sinon.assert.calledWith( - this.SplitTestHandler.promises.getAssignmentForUser, - this.userId, - 'trial-onboarding-email' - ) }) - it('sends free trial onboarding email if user in ab group', async function () { - this.SplitTestHandler.promises.getAssignmentForUser = sinon - .stub() - .resolves({ variant: 'send-email' }) - + it('sends free trial onboarding email if user starting a trial', async function () { await this.RecurlyEventHandler.sendRecurlyAnalyticsEvent( 'new_subscription_notification', this.eventData ) - sinon.assert.calledWith( - this.SplitTestHandler.promises.getAssignmentForUser, - this.userId, - 'trial-onboarding-email' - ) sinon.assert.called(this.SubscriptionEmailHandler.sendTrialOnboardingEmail) }) @@ -356,6 +337,5 @@ describe('RecurlyEventHandler', function () { sinon.assert.notCalled(this.AnalyticsManager.setUserPropertyForUser) sinon.assert.notCalled(this.AnalyticsManager.setUserPropertyForUser) sinon.assert.notCalled(this.AnalyticsManager.setUserPropertyForUser) - sinon.assert.notCalled(this.SplitTestHandler.promises.getAssignmentForUser) }) })