[web] Target all group subscriptions on Survey configuration (#31928)

Update the toggle behaviour to target all group subscription users,
regardless of whether they are in Recurly or Stripe.

GitOrigin-RevId: a3e72d93e440a8941472f868e387a654b8908d1f
This commit is contained in:
Miguel Serrano
2026-03-03 13:16:03 +01:00
committed by Copybot
parent 84152a76d1
commit c1c9b9e1b7
3 changed files with 6 additions and 7 deletions
@@ -71,12 +71,11 @@ const SubscriptionLocator = {
return subscription?.admin_id
},
async hasRecurlyGroupSubscription(userOrId) {
async hasGroupSubscription(userOrId) {
if (!Features.hasFeature('saas')) return false
const userId = SubscriptionLocator._getUserId(userOrId)
return await Subscription.exists({
groupPlan: true,
recurlySubscription_id: { $exists: true },
$or: [
{ member_ids: userId },
{ manager_ids: userId },
@@ -19,10 +19,10 @@ import UserGetter from '../User/UserGetter.mjs'
async function getSurvey(userId) {
const survey = await SurveyCache.get(true)
if (survey) {
if (survey.options?.hasRecurlyGroupSubscription) {
const hasRecurlyGroupSubscription =
await SubscriptionLocator.promises.hasRecurlyGroupSubscription(userId)
if (!hasRecurlyGroupSubscription) {
if (survey.options?.hasGroupSubscription) {
const hasGroupSubscription =
await SubscriptionLocator.promises.hasGroupSubscription(userId)
if (!hasGroupSubscription) {
return
}
}
+1 -1
View File
@@ -36,7 +36,7 @@ export const SurveySchema = new Schema(
required: true,
},
options: {
hasRecurlyGroupSubscription: {
hasGroupSubscription: {
type: Boolean,
default: false,
},