From 0dab9369ee3ac43fd15621e47df591dc07468282 Mon Sep 17 00:00:00 2001 From: Kristina <7614497+khjrtbrg@users.noreply.github.com> Date: Wed, 18 Jun 2025 09:29:46 +0200 Subject: [PATCH] Merge pull request #26434 from overleaf/kh-limit-trial-extentions [web] limit trial extensions GitOrigin-RevId: 57973190cdb57a04ce6a2585394bcb38321838f7 --- .../web/app/src/Features/Subscription/RecurlyWrapper.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/services/web/app/src/Features/Subscription/RecurlyWrapper.js b/services/web/app/src/Features/Subscription/RecurlyWrapper.js index d5c2369009..243da6edce 100644 --- a/services/web/app/src/Features/Subscription/RecurlyWrapper.js +++ b/services/web/app/src/Features/Subscription/RecurlyWrapper.js @@ -693,12 +693,15 @@ const promises = { } }, - async extendTrial(subscriptionId, daysUntilExpire) { + async extendTrial(subscriptionId, trialEndsAt, daysUntilExpire) { if (daysUntilExpire == null) { daysUntilExpire = 7 } + if (trialEndsAt == null) { + trialEndsAt = new Date() + } const nextRenewalDate = new Date() - nextRenewalDate.setDate(nextRenewalDate.getDate() + daysUntilExpire) + nextRenewalDate.setDate(trialEndsAt.getDate() + daysUntilExpire) logger.debug( { subscriptionId, daysUntilExpire }, 'Exending Free trial for user'