mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-31 21:01:33 +02:00
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:
@@ -11,7 +11,6 @@ import EmailHandler from '../Email/EmailHandler.mjs'
|
||||
import { callbackify } from '@overleaf/promise-utils'
|
||||
import UserUpdater from '../User/UserUpdater.mjs'
|
||||
import Modules from '../../infrastructure/Modules.mjs'
|
||||
import SplitTestHandler from '../SplitTests/SplitTestHandler.mjs'
|
||||
import { AI_ADD_ON_CODE } from './AiHelper.mjs'
|
||||
|
||||
/**
|
||||
@@ -155,11 +154,6 @@ async function cancelPendingSubscriptionChange(user) {
|
||||
* @param user
|
||||
*/
|
||||
async function _sendCancellationEmail(user) {
|
||||
const { variant } = await SplitTestHandler.promises.getAssignmentForUser(
|
||||
user._id,
|
||||
'cancellation-survey-ai-assist'
|
||||
)
|
||||
|
||||
const emailOpts = {
|
||||
to: user.email,
|
||||
first_name: user.first_name,
|
||||
@@ -167,26 +161,16 @@ async function _sendCancellationEmail(user) {
|
||||
|
||||
const ONE_HOUR_IN_MS = 1000 * 60 * 60
|
||||
|
||||
if (variant === 'enabled') {
|
||||
logger.debug(
|
||||
{ userId: user._id },
|
||||
'deferred email: canceledSubscriptionOrAddOn'
|
||||
)
|
||||
logger.debug(
|
||||
{ userId: user._id },
|
||||
'deferred email: canceledSubscriptionOrAddOn'
|
||||
)
|
||||
|
||||
EmailHandler.sendDeferredEmail(
|
||||
'canceledSubscriptionOrAddOn',
|
||||
emailOpts,
|
||||
ONE_HOUR_IN_MS
|
||||
)
|
||||
} else {
|
||||
logger.debug({ userId: user._id }, 'deferred email: canceledSubscription')
|
||||
|
||||
EmailHandler.sendDeferredEmail(
|
||||
'canceledSubscription',
|
||||
emailOpts,
|
||||
ONE_HOUR_IN_MS
|
||||
)
|
||||
}
|
||||
EmailHandler.sendDeferredEmail(
|
||||
'canceledSubscriptionOrAddOn',
|
||||
emailOpts,
|
||||
ONE_HOUR_IN_MS
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -516,7 +516,7 @@ describe('SubscriptionHandler', function () {
|
||||
it('should send the email after 1 hour', function (ctx) {
|
||||
const ONE_HOUR_IN_MS = 1000 * 60 * 60
|
||||
expect(ctx.EmailHandler.sendDeferredEmail).to.have.been.calledWith(
|
||||
'canceledSubscription',
|
||||
'canceledSubscriptionOrAddOn',
|
||||
{ to: ctx.user.email, first_name: ctx.user.first_name },
|
||||
ONE_HOUR_IN_MS
|
||||
)
|
||||
@@ -618,7 +618,7 @@ describe('SubscriptionHandler', function () {
|
||||
it('should send the email after 1 hour', function (ctx) {
|
||||
const ONE_HOUR_IN_MS = 1000 * 60 * 60
|
||||
expect(ctx.EmailHandler.sendDeferredEmail).to.have.been.calledWith(
|
||||
'canceledSubscription',
|
||||
'canceledSubscriptionOrAddOn',
|
||||
{ to: ctx.user.email, first_name: ctx.user.first_name },
|
||||
ONE_HOUR_IN_MS
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user