mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-07 08:09:01 +02:00
[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:
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ export const SurveySchema = new Schema(
|
||||
required: true,
|
||||
},
|
||||
options: {
|
||||
hasRecurlyGroupSubscription: {
|
||||
hasGroupSubscription: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user