Tear down cancellation-survey-ai-assist feature flag (#32129)

* tearing down the cancellation-survey-ai-assist

* fixing a failing test

GitOrigin-RevId: 592873217120c2b19f5dccd2575b56cce4d8f0b5
This commit is contained in:
Davinder Singh
2026-03-16 11:56:39 +00:00
committed by Copybot
parent 89004b9535
commit b7f140ba0b
2 changed files with 11 additions and 27 deletions
@@ -11,7 +11,6 @@ import EmailHandler from '../Email/EmailHandler.mjs'
import { callbackify } from '@overleaf/promise-utils' import { callbackify } from '@overleaf/promise-utils'
import UserUpdater from '../User/UserUpdater.mjs' import UserUpdater from '../User/UserUpdater.mjs'
import Modules from '../../infrastructure/Modules.mjs' import Modules from '../../infrastructure/Modules.mjs'
import SplitTestHandler from '../SplitTests/SplitTestHandler.mjs'
import { AI_ADD_ON_CODE } from './AiHelper.mjs' import { AI_ADD_ON_CODE } from './AiHelper.mjs'
/** /**
@@ -155,11 +154,6 @@ async function cancelPendingSubscriptionChange(user) {
* @param user * @param user
*/ */
async function _sendCancellationEmail(user) { async function _sendCancellationEmail(user) {
const { variant } = await SplitTestHandler.promises.getAssignmentForUser(
user._id,
'cancellation-survey-ai-assist'
)
const emailOpts = { const emailOpts = {
to: user.email, to: user.email,
first_name: user.first_name, first_name: user.first_name,
@@ -167,26 +161,16 @@ async function _sendCancellationEmail(user) {
const ONE_HOUR_IN_MS = 1000 * 60 * 60 const ONE_HOUR_IN_MS = 1000 * 60 * 60
if (variant === 'enabled') { logger.debug(
logger.debug( { userId: user._id },
{ userId: user._id }, 'deferred email: canceledSubscriptionOrAddOn'
'deferred email: canceledSubscriptionOrAddOn' )
)
EmailHandler.sendDeferredEmail( EmailHandler.sendDeferredEmail(
'canceledSubscriptionOrAddOn', 'canceledSubscriptionOrAddOn',
emailOpts, emailOpts,
ONE_HOUR_IN_MS ONE_HOUR_IN_MS
) )
} else {
logger.debug({ userId: user._id }, 'deferred email: canceledSubscription')
EmailHandler.sendDeferredEmail(
'canceledSubscription',
emailOpts,
ONE_HOUR_IN_MS
)
}
} }
/** /**
@@ -516,7 +516,7 @@ describe('SubscriptionHandler', function () {
it('should send the email after 1 hour', function (ctx) { it('should send the email after 1 hour', function (ctx) {
const ONE_HOUR_IN_MS = 1000 * 60 * 60 const ONE_HOUR_IN_MS = 1000 * 60 * 60
expect(ctx.EmailHandler.sendDeferredEmail).to.have.been.calledWith( expect(ctx.EmailHandler.sendDeferredEmail).to.have.been.calledWith(
'canceledSubscription', 'canceledSubscriptionOrAddOn',
{ to: ctx.user.email, first_name: ctx.user.first_name }, { to: ctx.user.email, first_name: ctx.user.first_name },
ONE_HOUR_IN_MS ONE_HOUR_IN_MS
) )
@@ -618,7 +618,7 @@ describe('SubscriptionHandler', function () {
it('should send the email after 1 hour', function (ctx) { it('should send the email after 1 hour', function (ctx) {
const ONE_HOUR_IN_MS = 1000 * 60 * 60 const ONE_HOUR_IN_MS = 1000 * 60 * 60
expect(ctx.EmailHandler.sendDeferredEmail).to.have.been.calledWith( expect(ctx.EmailHandler.sendDeferredEmail).to.have.been.calledWith(
'canceledSubscription', 'canceledSubscriptionOrAddOn',
{ to: ctx.user.email, first_name: ctx.user.first_name }, { to: ctx.user.email, first_name: ctx.user.first_name },
ONE_HOUR_IN_MS ONE_HOUR_IN_MS
) )