Explorar el Código

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

* tearing down the cancellation-survey-ai-assist

* fixing a failing test

GitOrigin-RevId: 592873217120c2b19f5dccd2575b56cce4d8f0b5
Davinder Singh hace 7 meses
padre
commit
b7f140ba0b

+ 9 - 25
services/web/app/src/Features/Subscription/SubscriptionHandler.mjs

@@ -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(
-      { userId: user._id },
-      'deferred email: canceledSubscriptionOrAddOn'
-    )
-
-    EmailHandler.sendDeferredEmail(
-      'canceledSubscriptionOrAddOn',
-      emailOpts,
-      ONE_HOUR_IN_MS
-    )
-  } else {
-    logger.debug({ userId: user._id }, 'deferred email: canceledSubscription')
+  logger.debug(
+    { userId: user._id },
+    'deferred email: canceledSubscriptionOrAddOn'
+  )
 
 
-    EmailHandler.sendDeferredEmail(
-      'canceledSubscription',
-      emailOpts,
-      ONE_HOUR_IN_MS
-    )
-  }
+  EmailHandler.sendDeferredEmail(
+    'canceledSubscriptionOrAddOn',
+    emailOpts,
+    ONE_HOUR_IN_MS
+  )
 }
 }
 
 
 /**
 /**

+ 2 - 2
services/web/test/unit/src/Subscription/SubscriptionHandler.test.mjs

@@ -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
           )
           )